ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   columns identification (https://www.excelbanter.com/excel-programming/372054-columns-identification.html)

LearningVBA

columns identification
 
Hello, I am using [lastColumn = Range("BB1").End(xlToLeft).Column] to find
out where is the last column, it will return an integer. I can not use this
integer in the following: [Columns("A:" & lastColumn).NumberFormat = "@" for
example. I have to hard code the equivalent like [Columns("A:" &
lastColumnStr).NumberFormat ...]. This is not practical if the report is
dropping or adding a column. Is there a way to solve this if I want to use
the following construct: [Columns("A:" & lastColumn).NumberFormat ....]?

Thank you for your input



Bob Phillips

columns identification
 
Columns("A").Resize(, lastColumn).NumberFormat ...

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"LearningVBA" wrote in message
...
Hello, I am using [lastColumn = Range("BB1").End(xlToLeft).Column] to

find
out where is the last column, it will return an integer. I can not use

this
integer in the following: [Columns("A:" & lastColumn).NumberFormat = "@"

for
example. I have to hard code the equivalent like [Columns("A:" &
lastColumnStr).NumberFormat ...]. This is not practical if the report is
dropping or adding a column. Is there a way to solve this if I want to

use
the following construct: [Columns("A:" & lastColumn).NumberFormat ....]?

Thank you for your input






All times are GMT +1. The time now is 10:36 PM.

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