bodhi808,
I have read through Stan's code a number of times but I've yet to fully get my head around it.
I hope this helps.
See the text lines beginning with '' in the code:
'' the next line of code says that I will be defining my variables
'' this is a very good programming practice, because, it will help
'' other programmers to understand the workings of the macro.
Option Explicit
Sub ReorgAthruH()
' stanleydgromjr, 04/25/2013
' http://www.excelforum.com/excel-programming-vba-macros/918047-need-macro-to-remove-unwanted-data-from-large-tables.html
Dim a As Variant, b As Variant, lr As Long, i As Long, ii As Long, iii As Long
'' find the last used row in the worksheet
lr = Cells.Find("*", , xlValues, xlWhole, xlByRows, xlPrevious, False).Row
'' create variant array a(1 to 45, 1 to 8)
a = Range("A2:H" & lr)
'' create variant array b the same size as array a
'' b(1 t 45, 1 to 8)
ReDim b(1 To UBound(a, 1), 1 To UBound(a, 2))
'' using the i Long variable as a counter
'' loop from the first row of the array to the last row of the array
For i = 1 To UBound(a, 1)
'' *********************************************************** see below
'' we are checking each item in the second column of the array
'' if Left(a(i,2),2) = "00"
'' Or a(i,2) = ""
'' Or a(i,2) Like "*[A-Z,a-z]*" contains any alpha upper/lower case characters
'' then do not write the items in the row to the b array
If Left(a(i, 2), 2) = "00" Or a(i, 2) = "" Or a(i, 2) Like "*[A-Z,a-z]*" Then
'do nothing
'' then write the items in the row to the b array
Else
'' increment the iii Long variable by 1
iii = iii + 1
'' loop from the 1st 'column like' item of the a array to the last 'column like' item in the row
For ii = 1 To UBound(a, 2)
'' write the items in the a array to the b array
b(iii, ii) = a(i, ii)
'' and loop
Next ii
End If
'' And loop to the next row in the a array
Next i
'' write the b array which is the same size as the a array beginning in A2
'' but, the b array does not contain any of the rows of information that
'' we did not want to write
'' *********************************************************** see above
'' we are checking each item in the second column of the array
'' if Left(a(i,2),2) = "00"
'' Or a(i,2) = ""
'' Or a(i,2) Like "*[A-Z,a-z]*" contains any alpha upper/lower case characters
'' then do not write the items in the row to the b array
Range("A2:H" & lr) = b
End Sub
Bookmarks