I have a userform with a commandbutton that I would like to have call the same procedure whenever the commandbutton is pressed. I am using Excel 2003.
The code for the command button is:
Private Sub CommandButton16_Click()
Sheets("Info").Select
Call Fill
UserForm1.Hide
Application.Visible = True
End Sub
'and the module code is:
Sub Fill()
Range("C1").Select
Range("C1") = SalesRegion
Range("C3") = GroupID
Range("C4") = GroupName
Range("C5") = FirstName
End Sub
When I currenty hit the command button I do not get any error messages, and my sheet (Info) is selected, my cell (C1) is selected, my userform hides, and my application is visible. It's as if the Sub Fill stops after Range("C1").Select. I've checked the spelling of my texbox names (SalesRegion, GroupID, GroupName) and they all match...in fact, the following code works when I place it in the Commandbutton:
Private Sub CommandButton16_Click()
Sheets("Info").Select
Range("C1").Select
Range("C1") = SalesRegion
Range("C3") = GroupID
Range("C4") = GroupName
Range("C5") = FirstName
UserForm1.Hide
Application.Visible = True
End Sub
but that dosen't help me, as I want the same routine to fire anytime I hit a handfull of commandbuttons.
The code for the command button is:
Private Sub CommandButton16_Click()
Sheets("Info").Select
Call Fill
UserForm1.Hide
Application.Visible = True
End Sub
'and the module code is:
Sub Fill()
Range("C1").Select
Range("C1") = SalesRegion
Range("C3") = GroupID
Range("C4") = GroupName
Range("C5") = FirstName
End Sub
When I currenty hit the command button I do not get any error messages, and my sheet (Info) is selected, my cell (C1) is selected, my userform hides, and my application is visible. It's as if the Sub Fill stops after Range("C1").Select. I've checked the spelling of my texbox names (SalesRegion, GroupID, GroupName) and they all match...in fact, the following code works when I place it in the Commandbutton:
Private Sub CommandButton16_Click()
Sheets("Info").Select
Range("C1").Select
Range("C1") = SalesRegion
Range("C3") = GroupID
Range("C4") = GroupName
Range("C5") = FirstName
UserForm1.Hide
Application.Visible = True
End Sub
but that dosen't help me, as I want the same routine to fire anytime I hit a handfull of commandbuttons.