W
WLMPilot
I have a worksheet that has 12 different sections (one for each month) used
to enter data to balance a checkbook. I use a commandbutton for each month.
I am not quite sure how to explain what I want to do so I will use the
"normal" code and the the code I have to replace the normal code. Then I
will ask the question.
NORMAL CODE
Private Sub CommandButton1_Click()
Application.Goto Reference:="JAN08"
End Sub
NEW CODE TO DO THE SAME THING
Private Sub CommandButton1_Click()
Dim mnth As String
mnth = CommandButton1.Caption & "08"
Application.Goto Reference:=mnth
End Sub
The caption is the first three letters of each month (JAN, FEB, MAR, etc.)
The cell name for each month is JAN08, FEB08, etc.
Here is my question. Is there a way to determine which commandbutton was
clicked so that I do not have to edit each of the 12 macros and change the
numerical value of each commandbutton within the subroutine?
I was trying to pull out the "name", just as I did with caption, and then do
a RIGHT function and get the number. In the properties of each commandbutton
is "(NAME)". I was not sure if I could access that field.
Thanks,
Les
to enter data to balance a checkbook. I use a commandbutton for each month.
I am not quite sure how to explain what I want to do so I will use the
"normal" code and the the code I have to replace the normal code. Then I
will ask the question.
NORMAL CODE
Private Sub CommandButton1_Click()
Application.Goto Reference:="JAN08"
End Sub
NEW CODE TO DO THE SAME THING
Private Sub CommandButton1_Click()
Dim mnth As String
mnth = CommandButton1.Caption & "08"
Application.Goto Reference:=mnth
End Sub
The caption is the first three letters of each month (JAN, FEB, MAR, etc.)
The cell name for each month is JAN08, FEB08, etc.
Here is my question. Is there a way to determine which commandbutton was
clicked so that I do not have to edit each of the 12 macros and change the
numerical value of each commandbutton within the subroutine?
I was trying to pull out the "name", just as I did with caption, and then do
a RIGHT function and get the number. In the properties of each commandbutton
is "(NAME)". I was not sure if I could access that field.
Thanks,
Les