ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   last column of a row (https://www.excelbanter.com/excel-programming/334155-last-column-row.html)

Nazrul[_3_]

last column of a row
 
I would like to know the last filled column of a row. I wrote this lastCol =
cells(1, columns.count) that returns 256. But I have only 101 columns filled
with data. So I was expecting lastCol is equal to 101.

I am doing something wrong to find last filled column number. Can you please
help me?

Nazrul

Don Guillett[_4_]

last column of a row
 
how about
cells(1, columns.count).end(xltoleft).column

--
Don Guillett
SalesAid Software

"Nazrul" wrote in message
...
I would like to know the last filled column of a row. I wrote this lastCol

=
cells(1, columns.count) that returns 256. But I have only 101 columns

filled
with data. So I was expecting lastCol is equal to 101.

I am doing something wrong to find last filled column number. Can you

please
help me?

Nazrul




Ron de Bruin

last column of a row
 
Try this

MsgBox Cells(ActiveCell.Row, "IV").End(xlToLeft).Column


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Nazrul" wrote in message ...
I would like to know the last filled column of a row. I wrote this lastCol =
cells(1, columns.count) that returns 256. But I have only 101 columns filled
with data. So I was expecting lastCol is equal to 101.

I am doing something wrong to find last filled column number. Can you please
help me?

Nazrul




Nazrul[_3_]

last column of a row
 
It works. Thanks Don.

"Don Guillett" wrote:

how about
cells(1, columns.count).end(xltoleft).column

--
Don Guillett
SalesAid Software

"Nazrul" wrote in message
...
I would like to know the last filled column of a row. I wrote this lastCol

=
cells(1, columns.count) that returns 256. But I have only 101 columns

filled
with data. So I was expecting lastCol is equal to 101.

I am doing something wrong to find last filled column number. Can you

please
help me?

Nazrul





Don Guillett[_4_]

last column of a row
 
glad it helped


--
Don Guillett
SalesAid Software

"Nazrul" wrote in message
...
It works. Thanks Don.

"Don Guillett" wrote:

how about
cells(1, columns.count).end(xltoleft).column

--
Don Guillett
SalesAid Software

"Nazrul" wrote in message
...
I would like to know the last filled column of a row. I wrote this

lastCol
=
cells(1, columns.count) that returns 256. But I have only 101 columns

filled
with data. So I was expecting lastCol is equal to 101.

I am doing something wrong to find last filled column number. Can you

please
help me?

Nazrul








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

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