Elseif issue

erutherford

Active Member
Joined
Dec 19, 2016
Messages
348
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>
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
36,006
Office Version
365
Platform
Windows
What error do you get?
 

erutherford

Active Member
Joined
Dec 19, 2016
Messages
348
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>
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
36,006
Office Version
365
Platform
Windows
Is the "Scores" sheet protected?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
36,006
Office Version
365
Platform
Windows
Then you either have to unprotect it, select as unlocked cell, or use a different method.
 

Watch MrExcel Video

Forum statistics

Threads
1,090,220
Messages
5,413,146
Members
403,465
Latest member
Frankariye

This Week's Hot Topics

Top