excel - Error on Union when looping through multiple worksheets -


I'm trying to remove the matching criteria rows from the rows in a sheet away from the worksheet. I need to cycle through all the other worksheets in your workbook, and every time I get some, I would like to remove the entire row in the first sheet I am getting 1004 error at the Union, I thought it might cause Because you can not use the union on sheets, so I did not set anything after each sheet. I'm still getting the same error code

here:.

  sub findRemaining () Dim rngToDel as range dim fRng as customs 'fund range wCell retarded range as "work sheet sales dim wRng as customs' Working Sheet Range dim FRng = worksheet ("all") range ("B2: B1495"), set the integer dim as WS_Count. WS_Count = to ActiveWorkbook.Worksheets.Count I to = 2 WS_Count set rngToDel = Nothing Set wRng = worksheet (I) .Range ( "B-2: B200") each wCell in wRng if the wCell fund range could then line delete "loop not 'if through all the work cells ISERROR (Application.Match (trim (wCell.Value), fRng, 0)) then rngToDel then set nothing, so rngToDel = wCell otherwise set rngToDel = Union (rngToDel, wCell) end and the other end next wCell is not even rngToDel something so rngToDel.EntireRow.Delete Next I end Su B    

The problem was to set the limit to delete as In wCell wRng , but in fact the cells I wanted to delete were cells in fRng . Determining that the rest of the code works perfectly. (Thanks Chris)

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -