How to count last column of data

  • Thread starter Thread starter crapit
  • Start date Start date
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?
 
lastcol=Worksheets("Spare2").cells(rows.count,1).end(xltoleft).column

HTH
 
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)
 
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)
 
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)
 
myVal = Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft)

--
HTH

Bob Phillips

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top