pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
I'm looping through all the col till it is blank.
If col if 1st row is not blank i want to define lastrow to this col last row. for example
range("A" & rows.count).end(xlup).row
i want "A" row above to be x row...
I think i'm making sense...please help me out;
If col if 1st row is not blank i want to define lastrow to this col last row. for example
range("A" & rows.count).end(xlup).row
i want "A" row above to be x row...
I think i'm making sense...please help me out;
Code:
[/FONT]
[FONT=Courier New]Sub test()
Dim LastCol As Integer, c As Integer, myrng as range
LastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column
For c = 1 To LastCol
If Cells(1, c).Value <> "" Then[/FONT]
[FONT=Courier New] x= Cells(1, c).Value[/FONT]
[FONT=Courier New][COLOR=blue][I][B] lastrow = ?? c column last row[/B][/I][/COLOR][/FONT][FONT=Courier New] [/FONT]
[FONT=Courier New] set myrng = c.offset(1,0).resize(lastrow)[/FONT]
[FONT=Courier New]End If
Next c
End Sub