ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last column? (https://www.excelbanter.com/excel-programming/306259-last-column.html)

Mike D.[_2_]

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.

Tom Ogilvy

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.




No Name

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.



.


Tom Ogilvy

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.



.




No Name

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.


.



.



All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com