Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Find last column with data?

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!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Find last column with data?

Hi,

Try this

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

the 2 represents row 2 so change to suit

Mike

"Myles" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Find last column with data?

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



"Myles" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Find last column with data?

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Myles" wrote in message
...
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!!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compare data in column A with column B to find duplicates George Excel Discussion (Misc queries) 8 February 6th 09 03:53 PM
find the data of the corresponding column liu New Users to Excel 2 May 1st 08 10:09 PM
Find Last data in a column Steve Excel Worksheet Functions 7 March 18th 07 11:11 AM
HOW DO I FIND DATA IN A TABLE BY LOOKING UP BOTH THE COLUMN AND R. Ziv Excel Worksheet Functions 2 February 3rd 05 06:29 AM
find rows for unique data in 1 column and different data in other. Dot Majewski Excel Discussion (Misc queries) 1 January 21st 05 12:23 AM


All times are GMT +1. The time now is 06:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"