Lewiy
Well-known Member
- Joined
- Jan 5, 2007
- Messages
- 4,284
Hi Everyone!
It's been a while since I frequented these parts, but as I was writing some code today, it suddenly struck me that there are a few lines or chunks which I use almost every time I'm working with VBA, which I can type out with my eyes closed whilst having an entirely unrelated conversation with a colleague (yeah, they wonder why I look like I'm asleep whilst talking to them)! So that got me wondering about what other people find they use ALL the time, be it VBA or perhaps specific combinations of functions in formulas.
To kick things off, my number one most frequently used chunk of VBA is for looping through all the rows in a worksheet:
It's been a while since I frequented these parts, but as I was writing some code today, it suddenly struck me that there are a few lines or chunks which I use almost every time I'm working with VBA, which I can type out with my eyes closed whilst having an entirely unrelated conversation with a colleague (yeah, they wonder why I look like I'm asleep whilst talking to them)! So that got me wondering about what other people find they use ALL the time, be it VBA or perhaps specific combinations of functions in formulas.
To kick things off, my number one most frequently used chunk of VBA is for looping through all the rows in a worksheet:
Code:
Dim Limit As Long
Dim r As Long
With Sheets("SheetName")
Limit = .Cells(.Rows.Count, 1).End(xlUp).Row
For r = 2 To Limit
'Do something
Next r
End With