View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Iteratively delete rows from a spreadsheet

Had a senior moment there.

Change the line:

For i = lr To 2

To:

For i = lr To 2 Step -1



"Vicki Hagberg" wrote in message
...
I have a very large spreadsheet (about 50,000 rows, and to CM of
columns) with blocks of data 20 rows high (rows 1-20 are from Building
A, rows 21-40 are from Building B, etc). However, not every row in
each block of 20 has information in it - some are just placeholders.
For example, some blocks may have rows 1-18 filled with data while
other blocks may have only 1-6 filled with data.

I am interested in programming a macro that would delete the
placeholder rows out of the spreadsheet based on a certain criteria.
This would probably halve the size of my spreadsheet.

In faux-code:

For row i
i = 1 to 50,000
If Column B = #NA
Delete row i


Is this something that can be done with a macro, or do I need to go
through all of these rows by hand? Obviously, I haven't programmed
macros before (I've taken code and run it), but I've programmed in
other languages (Java, C#). Could someone point me in the right
direction?

Thanks,

V. Hagberg