-
Solved: Test if last column is longer than first column
I have code that I use to check the first column length and then check the last column length and then set the finalrow to the length of the longer of the two:
[VBA]finalRow = Cells(Rows.Count, "A").End(xlUp).Row
finalColumn = Cells(1, 100).End(xlToLeft).Column
finalRowLast = Cells(Rows.Count, finalColumn).End(x1up).Row
If finalRowLast > finalRow Then finalRow = finalRowLast[/VBA]
However, I can't get it to work. It seems so simple but I can't figure it out.
-
[vba]
With ActiveSheet
finalRow = .Cells(.Rows.Count, "A").End(xlUp).Row
finalColumn = .Cells(1, .Columns.Count).End(xlToLeft).Column
finalRowLast = .Cells(Rows.Count, finalColumn).End(xlUp).Row
If finalRowLast > finalRow Then finalRow = finalRowLast
End With
[/vba]
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules