Hello there,
I have a button which needs to act based on caption of button.. below is my code so far..pls help.. getting error at Me function .. dont want to use useform..
I have a button which needs to act based on caption of button.. below is my code so far..pls help.. getting error at Me function .. dont want to use useform..
Code:
Sub CommandButton1()
Dim xStr As String
Dim Model1 As String
Dim Model As String
Dim Model2 As String
Dim cb As CommandButton
'Let Me = cb
Set cb = Me.CommandButton1
If cb.Caption = "Do you want to convert to Title1?" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet2").Rows("15").EntireRow.Hidden = True
Sheets("Sheet3").Rows("10").EntireRow.Hidden = True
cb.Caption = "Do you want to convert to Title2?"
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet2").Rows("15").EntireRow.Hidden = False
Sheets("Sheet3").Rows("10").EntireRow.Hidden = False
cb.Caption = "Do you want to convert to Title1?"
End If
End Sub
Last edited by a moderator: