VBA Compile Error

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,538
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Need help with the error in th code


VBA Code:
Sub SolutionChecker()

If UserForm1.CommandButton1.Caption = "1" And UserForm1.CommandButton2.Caption = "2" And UserForm1.CommandButton3.Caption = "3" And

UserForm1.CommandButton4.Caption = "4" And UserForm1.CommandButton5.Caption = "5" And UserForm1.CommandButton6.Caption = "6" And
UserForm1.CommandButton7.Caption = "7" And UserForm1.CommandButton8.Caption = "8" And UserForm1.CommandButton6.Caption = "9" And
UserForm1.CommandButton10.Caption = "10" And UserForm1.CommandButton11.Caption = "11" And UserForm1.CommandButton12.Caption = "12" And
UserForm1.CommandButton13.Caption = "13" And UserForm1.CommandButton14.Caption = "14" And UserForm1.CommandButton15.Caption = "15"

MsgBox ("Well done, you are a Dazzling Star")


End If

UserForm1.Count = UserForm1.Count + 1
UserForm1.Caption = "Number of Clicks " & UserForm1.Count
UserForm1.TextBox1.Text = UserForm1.Caption
End Sub




1668684491981.png
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You need an underscore line continuation character at the end of that line, so it should end with And _ and the same for the other three red lines.
 
Upvote 0
There needs to be a space before the underscore as I indicated. You do also appear to be missing Then from the last line of the If line.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,420
Messages
6,124,803
Members
449,190
Latest member
cindykay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top