ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Increment columns (https://www.excelbanter.com/excel-programming/306287-how-increment-columns.html)

Glen Mettler[_3_]

How to Increment columns
 
I want to start at column 20 and incrment by 1 and insert
a heading for each column - all via a macro.

I can capture the column index but I can't seem to
increment to the next column.

Help

Glen


Tom Ogilvy

How to Increment columns
 
cells(1,20).Value = Array("Header1", "Header2", _
"Header3", "Header4", . . . , "Header30")

or

for i = 1 to 30
cells(1,i + 19).Value = "Header" & i
Next

--
Regards,
Tom Ogilvy

"Glen Mettler" wrote in message
...
I want to start at column 20 and incrment by 1 and insert
a heading for each column - all via a macro.

I can capture the column index but I can't seem to
increment to the next column.

Help

Glen





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

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