Hi,
This is supposed to be a simple problem, but surprisingly I could not get it to work or find a relevant post about the same kind of problem.
I have 13 parameters called PEMAXX as listed below, the sub should use these parameters to create column tittles by calling the constant the first time and using the string stored in it then adding the word Trend then Adding the word Signal. The sub should create column tittles as follows:
PEMA3, PEMA3Trend, PEMA3Signal, PEMA5, PEMA5Trend, PEMA5Signal, and so on until PEMA13.
However the sub is not using the value in the constant, instead it is labeling the first 3 columns as Param1, then 3 columns as Param2, then 3 columns as Param3, etc.
I appreciate it if anyone can help, and thank you in advance.
This is supposed to be a simple problem, but surprisingly I could not get it to work or find a relevant post about the same kind of problem.
I have 13 parameters called PEMAXX as listed below, the sub should use these parameters to create column tittles by calling the constant the first time and using the string stored in it then adding the word Trend then Adding the word Signal. The sub should create column tittles as follows:
PEMA3, PEMA3Trend, PEMA3Signal, PEMA5, PEMA5Trend, PEMA5Signal, and so on until PEMA13.
However the sub is not using the value in the constant, instead it is labeling the first 3 columns as Param1, then 3 columns as Param2, then 3 columns as Param3, etc.
I appreciate it if anyone can help, and thank you in advance.
Code:
Public Const Param1 As String = "PEMA3"
Public Const Param2 As String = "PEMA5"
Public Const Param3 As String = "PEMA7"
Public Const Param4 As String = "PEMA10"
Public Const Param5 As String = "PEMA12"
Public Const Param6 As String = "PEMA15"
Public Const Param7 As String = "PEMA17"
Public Const Param8 As String = "PEMA20"
Public Const Param9 As String = "PEMA25"
Public Const Param10 As String = "PEMA35"
Public Const Param11 As String = "PEMA50"
Public Const Param12 As String = "PEMA100"
Public Const Param13 As String = "PEMA200"
Dim ColumnLabel As String
Sub FillColumLabels()
Dim i As Integer
Range(“A1”).Select
For i = 1 To 13
ActiveCell.Offset(0, 1).Select
ColumnLabel = "Param" & i
ActiveCell.Value = ColumnLabel
ActiveCell.Offset(0, 1).Select
ColumLabel = "Param" & i & "Trend"
ActiveCell.Value = ColumnLabel
ActiveCell.Offset(0, 1).Select
ColumLabel = "Param" & i & "Signal"
ActiveCell.Value = ColumnLabel
Next i
End Sub