ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to know the right most column? (https://www.excelbanter.com/excel-programming/343962-how-know-right-most-column.html)

ivan

How to know the right most column?
 
Dear all,

I would like to know how to get the right most column number whose cell has
a value in a row. Can anyone suggest how to do it programatically?
Thanks a lot.

Ivan

Jim Cone

How to know the right most column?
 
Ivan,
This post shows bottom row and right most column...
http://makeashorterlink.com/?Z53732E0C
Jim Cone
San Francisco, USA

"Ivan"
wrote in message

Dear all,
I would like to know how to get the right most column number whose cell has
a value in a row. Can anyone suggest how to do it programatically?
Thanks a lot.
Ivan

Norman Jones

How to know the right most column?
 
Hi Ivan,

For a specific row, try

LastColInRow = Cells(1, Columns.Count).End(xlToLeft).Column

MsgBox LastInCol

Replace 1 with the required row number.

---
Regards,
Norman



"Ivan" wrote in message
...
Dear all,

I would like to know how to get the right most column number whose cell
has
a value in a row. Can anyone suggest how to do it programatically?
Thanks a lot.

Ivan




David

How to know the right most column?
 
Hi Ivan,

Try:

With ActiveSheet.UsedRange
MsgBox .Column + .Columns.Count - 1
End With

HTH
--
David


"Ivan" wrote:

Dear all,

I would like to know how to get the right most column number whose cell has
a value in a row. Can anyone suggest how to do it programatically?
Thanks a lot.

Ivan



All times are GMT +1. The time now is 01:00 PM.

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