Find last column with data?

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!!
 
M

Mike H

Hi,

Try this

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

the 2 represents row 2 so change to suit

Mike
 
M

Myles

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!!
 
D

Don Guillett

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

Top