Hello All,
Background info: I am in finance with no coding expierence and I am trying to learn VBA (teaching myself). I started to learn/read about VBA about 2 weeks ago so i am very new. I am working toward learning the language as quickly as possible.
The question is that I have a piece of code (below) that works fine but runs a little slow. The number of rows vary from month to month when i pull this report. I have an array named "CAM" and would like to count the number of rows in this array and instert it where the 10000 is. So we would not go through rows with no data in it and it should process faster (i believe).
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = total To 2 Step -1
Select Case Range("F" & i).Value
Case "MOORESTOWN", "SYRACUSE", "Manassas", "Baltimore"
'do nothing
Case Else
Rows(i).EntireRow.Delete
End Select
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
I thought this would work but it does not...
dim total as integer
dim count as integer
count = 2
Do Until Cells(count, 2).Value <> ""
If Cells(count, 2).Value <> "" Then
'do nothing
End If
count = count + 1
Loop
total = count -------then plug total where 10000 is in the above code. I thought this owuld just count the number of cells in the array and then i would apply the count to total. but i must be missing something.
Thanks for the help in advance!
Background info: I am in finance with no coding expierence and I am trying to learn VBA (teaching myself). I started to learn/read about VBA about 2 weeks ago so i am very new. I am working toward learning the language as quickly as possible.
The question is that I have a piece of code (below) that works fine but runs a little slow. The number of rows vary from month to month when i pull this report. I have an array named "CAM" and would like to count the number of rows in this array and instert it where the 10000 is. So we would not go through rows with no data in it and it should process faster (i believe).
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = total To 2 Step -1
Select Case Range("F" & i).Value
Case "MOORESTOWN", "SYRACUSE", "Manassas", "Baltimore"
'do nothing
Case Else
Rows(i).EntireRow.Delete
End Select
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
I thought this would work but it does not...
dim total as integer
dim count as integer
count = 2
Do Until Cells(count, 2).Value <> ""
If Cells(count, 2).Value <> "" Then
'do nothing
End If
count = count + 1
Loop
total = count -------then plug total where 10000 is in the above code. I thought this owuld just count the number of cells in the array and then i would apply the count to total. but i must be missing something.
Thanks for the help in advance!