still learning
Well-known Member
- Joined
- Jan 15, 2010
- Messages
- 821
- Office Version
- 365
- Platform
- Windows
Hi
I have a userform that has a textbox that the user will enter a name
It also has 3 check boxes that the user will click on ( only 1 for each session)
When the user clicks on the command button, I want the name from the text box to go to a range (cell) and a macro to run …and the text box and check box to empty and the userform to close.
I’m still learning userform macros…. and came up with the following macro.
But I’m getting an error at the first “End If”….Compile error: end if without block if
That stops me from seeing if the rest will work
The different macros will match the name in cell and will put that name and the rest of the information in a new range to be viewed
I’ve tested them and they work.
I haven’t been able to get past the compile error to see if the rest of this macro will work
mike
I have a userform that has a textbox that the user will enter a name
It also has 3 check boxes that the user will click on ( only 1 for each session)
When the user clicks on the command button, I want the name from the text box to go to a range (cell) and a macro to run …and the text box and check box to empty and the userform to close.
I’m still learning userform macros…. and came up with the following macro.
But I’m getting an error at the first “End If”….Compile error: end if without block if
That stops me from seeing if the rest will work
VBA Code:
Sub CommandButton1_Click()
If Me.CheckBox1.Value = True Then
With TextBox1
ActiveSheet.Range("cc2").Value = .Text
End If
end with
macro1
If Me.CheckBox2.Value = True Then
With TextBox1
ActiveSheet.Range("cd2").Value = .Text
End If
end with
macro2
If Me.CheckBox2.Value = True Then
With TextBox1
ActiveSheet.Range("ce2").Value = .Text
End If[
end with
macro3
Unload Me
End Sub
I’ve tested them and they work.
I haven’t been able to get past the compile error to see if the rest of this macro will work
mike