ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Increase Column Heading Part 2 (https://www.excelbanter.com/excel-programming/355318-increase-column-heading-part-2-a.html)

Adam

Increase Column Heading Part 2
 
Starting with the 4th column, I want every third column in the forth row to
say Substation and then the number. I have set a variable that is the max
substation number. I can't get this to output anything. Thanks for the help.

For a = 1 To MaxSubNumber

columnNum = 4 + (a - 1) * 3
Cells(4, columnnum_.Value) = "Substation " & a

Next a

Martin

Increase Column Heading Part 2
 
The second argument of Cells should just be columnNum surely (don't know
where the _.Value came from)?

"Adam" wrote:

Starting with the 4th column, I want every third column in the forth row to
say Substation and then the number. I have set a variable that is the max
substation number. I can't get this to output anything. Thanks for the help.

For a = 1 To MaxSubNumber

columnNum = 4 + (a - 1) * 3
Cells(4, columnnum_.Value) = "Substation " & a

Next a


Adam

Increase Column Heading Part 2
 
Thank you

"Martin" wrote:

The second argument of Cells should just be columnNum surely (don't know
where the _.Value came from)?

"Adam" wrote:

Starting with the 4th column, I want every third column in the forth row to
say Substation and then the number. I have set a variable that is the max
substation number. I can't get this to output anything. Thanks for the help.

For a = 1 To MaxSubNumber

columnNum = 4 + (a - 1) * 3
Cells(4, columnnum_.Value) = "Substation " & a

Next a



All times are GMT +1. The time now is 05:29 PM.

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