Elseif issue

erutherford

Active Member
Joined
Dec 19, 2016
Messages
453
Not sure why this gets an error. It seems pretty simple.

Error occurs at the ElseIf "Application.GoTo ActiveWorkbook.Sheets("Scores").Cells(3, 1)" line

I replaced it with the App GoTo line above and if functions as it should, so its not liking the "Scores" name. Spelling correct, same workbook etc.

ideas???


<code>
Private Sub CommandButton1_Click() ' Main Page
If OBEntry.Value = True Then
Unload UserForm11
Application.GoTo ActiveWorkbook.Sheets("Entries").Cells(3, 1)


ElseIf OBScoring.Value = True Then
Unload UserForm11
Application.GoTo ActiveWorkbook.Sheets("Scores").Cells(3, 1)

Else
Unload UserForm11
UserForm12.Show

End If
End Sub

</code>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
If I use this code it functions fine, but I would like to know what rule I broke with the above code.

<code>
ThisWorkbook.Sheets("Scores").Activate
</code>
 
Upvote 0
Is the "Scores" sheet protected?
 
Upvote 0
Then you either have to unprotect it, select as unlocked cell, or use a different method.
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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