Find last column with data?

  • Thread starter Thread starter Myles
  • Start date Start date
M

Myles

Okay guys so i tried to convert some code i found for last Row with text in
it..

Function LastColumn(Row As String)
LastColumn = Range(Columns.Count & Row).End(xlToRight).Column
End Function

But i get an error when trying to use it

Does anybody know how to convert this to get the last column with text with
the Row is supplied?

Thanks!!
 
Hi,

Try this

LastCol = ActiveSheet.Cells(2, Columns.Count).End(xlToLeft).Column

the 2 represents row 2 so change to suit

Mike
 
I'm sorry, i meant last COLUMN that has text in it on one specific row. So
basically i know what row i want to look on, i just need to find out which
column it is and convert it to the letter.

Thanks!!
 
try it this way
Function LastColumn(x)
LastColumn = Cells(x, Columns.Count).End(xlToLeft).Column
End Function
 

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