This first one works, but note the variable you use is not the same as the one you Dim:
Sub trialtest()
Dim Lr As Long
With Sheets("Weird2")
LR1 = .Cells(.Rows.Count, 1).End(xlUp).Row
MsgBox LR1 'Ans 23
End With
End Sub
Second one works fine. Third one works fine but, again, not the variable in the loop vs the variable Dimmed
Sub Trialtest3()
With Worksheets("Sheet1")
LR2 = .Cells(.Rows.Count, 2).End(xlUp).Row
For Y = 1 To LR2
Debug.Print Y
Next Y
End With
End Sub
This last one, copied from your post and edited counts from 1 to 24.
I'm not entirely sure what you're doing wrong. These all seem to work as expected, barring the incorrect variable usage. Use Option Explicit to avoid this issue.
Regards, TMS
Bookmarks