finding last used column
Hi Craig,
Try something like:
'=============
Public Sub Tester()
Dim rw As Long
Dim lastCol As Long
rw = 2 '<<==== CHANGE
lastCol = Cells(rw, Columns.Count).End(xlToLeft).Column
MsgBox lastCol
End Sub
'<<=============
---
Regards,
Norman
"Craig" wrote in message
oups.com...
Hi
I'm looking for a way to find the last used column in a given row.
I've tried a couple methods without much luck. I've tried to replicate
the
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
for rows with
lastcolumn = cells("5", columns).End(xlLeft).Column
but this never seems to work for me, one problem i think i might be
having is that i can't reference a specific row number, as i'm using a
variable to identify the row name as well. any suggestions?
|