ValerieT
10-23-2013, 07:02 AM
Hello
I want to define a value to some variable (columns positioning) and keep this value for all subs I have in a module
I thought I could use " Static".. but I can't find how it work... I tried to put it everywhere :-)
In this example, I want the value of Col_Name (defined in Sub My_Columns) being available in Sub My_Nameprocess(). I know I could store it into a cells, but is there another simple way?
Static Sub My_Columns()
Static Col_Name as integer
Static Col_ID as integer
For i = 1 To 35
If Cells(1, i) = "Name" Then
Col_Name = i
Exit For
End If
Next i
If Col_Name = 0 Then
MsgBox ("Column ""Name"" not found, check your column header")
End If
End Sub
Sub My_Nameprocess()
For i = 1 To Endlign
If Cells(i, Col_Name) = 0 Then
....
.....
End If
Next i
End Sub
Thanks in advanced!
I want to define a value to some variable (columns positioning) and keep this value for all subs I have in a module
I thought I could use " Static".. but I can't find how it work... I tried to put it everywhere :-)
In this example, I want the value of Col_Name (defined in Sub My_Columns) being available in Sub My_Nameprocess(). I know I could store it into a cells, but is there another simple way?
Static Sub My_Columns()
Static Col_Name as integer
Static Col_ID as integer
For i = 1 To 35
If Cells(1, i) = "Name" Then
Col_Name = i
Exit For
End If
Next i
If Col_Name = 0 Then
MsgBox ("Column ""Name"" not found, check your column header")
End If
End Sub
Sub My_Nameprocess()
For i = 1 To Endlign
If Cells(i, Col_Name) = 0 Then
....
.....
End If
Next i
End Sub
Thanks in advanced!