How to count last column of data

C

crapit

Using excel VBa, I can count last row of data using lastrow =
Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
But how to use it for column?
 
B

Bob Phillips

Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column

for the last column in the first row

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
C

crapit

IT works!
Bob Phillips said:
Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column

for the last column in the first row

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
C

crapit

But how doI get the actual column "R" value?

Bob Phillips said:
Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column

for the last column in the first row

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
B

Bob Phillips

myVal = Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Top