sschwant
06-16-2016, 01:22 PM
I need to copy down formulas in range S2:AH2. However, the number of rows these formulas are referencing in columns A:R, will always be variable. I know there's a way to use count or Dim a Variable range of rows ... but not sure how to implement or write the code.
Hopefully, the attached image below is visible.
Thanks!
Steve
16412
cross posted: http://www.mrexcel.com/forum/excel-questions/947808-need-help-please-defining-dynamic-range-auto-fill-down-visual-basic-applications.html
This solved my problem:
Sub LastRow()
Dim lR As Long
lR = Range("A:R").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("S2:AH" & lR).FillDown
End Sub
Hopefully, the attached image below is visible.
Thanks!
Steve
16412
cross posted: http://www.mrexcel.com/forum/excel-questions/947808-need-help-please-defining-dynamic-range-auto-fill-down-visual-basic-applications.html
This solved my problem:
Sub LastRow()
Dim lR As Long
lR = Range("A:R").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("S2:AH" & lR).FillDown
End Sub