Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Last column?

Hi. I have a way to find the last row in a column:

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

How would I find the last column in a row?

Thanks!

Mike.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Last column?

for row 10 for example:

rwNumber = 10
lastColumn = Cells(rwnumber,columns.count).End(xltoLeft).Column

--
Regards,
Tom Ogilvy

"Mike D." wrote in message
...
Hi. I have a way to find the last row in a column:

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

How would I find the last column in a row?

Thanks!

Mike.



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Last column?

Thanks, Tom.

Is there a way to refer to the column letter instead? I
am trying to select all the columns with data in it by
using the "Columns" command.

For instance, Columns("A:C").select would select the first
three columns. Is there a way to use the column numbers
instead?

Thanks again,
Mike.

-----Original Message-----
for row 10 for example:

rwNumber = 10
lastColumn = Cells(rwnumber,columns.count).End

(xltoLeft).Column

--
Regards,
Tom Ogilvy

"Mike D." wrote in

message
...
Hi. I have a way to find the last row in a column:

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

How would I find the last column in a row?

Thanks!

Mike.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Last column?

Columns(1).Resize(,3)

would be A:C

But you could do

Dim rng as Range
set rng = Range(Cells(1,1),Cells(1,256).End(xltoLeft))
msgbox rng.entireColumn.Address

--
Regards,
Tom Ogilvy

wrote in message
...
Thanks, Tom.

Is there a way to refer to the column letter instead? I
am trying to select all the columns with data in it by
using the "Columns" command.

For instance, Columns("A:C").select would select the first
three columns. Is there a way to use the column numbers
instead?

Thanks again,
Mike.

-----Original Message-----
for row 10 for example:

rwNumber = 10
lastColumn = Cells(rwnumber,columns.count).End

(xltoLeft).Column

--
Regards,
Tom Ogilvy

"Mike D." wrote in

message
...
Hi. I have a way to find the last row in a column:

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

How would I find the last column in a row?

Thanks!

Mike.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Last column?

Thanks, Tom!
-----Original Message-----
Columns(1).Resize(,3)

would be A:C

But you could do

Dim rng as Range
set rng = Range(Cells(1,1),Cells(1,256).End(xltoLeft))
msgbox rng.entireColumn.Address

--
Regards,
Tom Ogilvy

wrote in message
...
Thanks, Tom.

Is there a way to refer to the column letter instead? I
am trying to select all the columns with data in it by
using the "Columns" command.

For instance, Columns("A:C").select would select the

first
three columns. Is there a way to use the column numbers
instead?

Thanks again,
Mike.

-----Original Message-----
for row 10 for example:

rwNumber = 10
lastColumn = Cells(rwnumber,columns.count).End

(xltoLeft).Column

--
Regards,
Tom Ogilvy

"Mike D." wrote

in
message
...
Hi. I have a way to find the last row in a column:

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

How would I find the last column in a row?

Thanks!

Mike.


.



.

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
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
Divide Column A by Column B multiply Column C Stumped Excel Worksheet Functions 3 December 28th 05 05:51 AM


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

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

About Us

"It's about Microsoft Excel"