Hi,
I have some simple VBA code which does not work the way I want. It's probably something simple. First, in the code
I would like to start the row count at row B3 not row B1; tried several options but all returned errors.
Although this code returns an answer, it is very slow. It takes 5 minutes to process only about 20,000 rows. If anyone in the Forum could help move the range starting point to cell B3 and speed up execution time to a couple of seconds that would be great. And BTW, I'm not locked into this code, whatever works best will be used.
Any help would be very much appreciated. Am running this on Excel 2007 and Excel 2016.
Thanks,
-Art
I have some simple VBA code which does not work the way I want. It's probably something simple. First, in the code
Code:
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
I would like to start the row count at row B3 not row B1; tried several options but all returned errors.
Code:
Sub Test2()
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To LastRow
Range("M" & i).Value = "dog"
If Range("M" & i).Value = "dog" Then Range("N" & i).Value = "cat"
Next i
End Sub
Although this code returns an answer, it is very slow. It takes 5 minutes to process only about 20,000 rows. If anyone in the Forum could help move the range starting point to cell B3 and speed up execution time to a couple of seconds that would be great. And BTW, I'm not locked into this code, whatever works best will be used.
Any help would be very much appreciated. Am running this on Excel 2007 and Excel 2016.
Thanks,
-Art