Ben has attended:
Excel VBA Introduction course
Excel VBA Introduction - Count Rows to set a For Range
Have been trying to replicate some of the code from the introduction course.
Am trying to use the Count function we discussed with Jens, in order to identify how many iterations to go through:
For I = 1 to (number of rows in the selected data)
I am using
Range("f3").CurrentRegion.Select
For i = 1 To (Selection.Rows.Count.Value)
Jens' way seemed very simple, but I can't find anything as simple on Google.
thanks
RE: Excel VBA Introduction - Count Rows to set a For Range
Hi Ben,
Thank you for your question. It works best if you declare two simple variables.
The code will look as follows:
Dim rowcounter as long
Dim i as long
rowcounter = range("f3").currentregion.rows.count
For i = 1 to rowcounter
(Place the rest of your code here to state what needs to happen with the records)
Next i
I hope this helps!
Kind regards
Marius Barnard
STL Trainer