If ActiveSheet = .. then - I get an error

E

Eager2Learn

Hello,
I am getting an error with this simple code. Help.

Sub MainSort()
If ActiveSheet = Worksheets("1-OPEN") Then Call Sort
If ActiveSheet = Worksheets("Internal Transfers") Then Cal
SortStatus
MsgBox ("Sorry, sort not available")
End Sub

Help
 
M

mudraker

Eager2Learn

Try

Sub MainSort()
select case activesheet.name
case "1-OPEN"
Call Sort
case "Internal Transfers"
Call SortStatus
end select
MsgBox ("Sorry, sort not available")
End Su
 
V

Vasant Nanavati

Sub MainSort()
If ActiveSheet.Name = "1-OPEN" Then
Call Sort
ElseIf ActiveSheet.Name = "Internal Transfers" Then
Call SortStatus
Else
MsgBox ("Sorry, sort not available")
End If
End Sub
 
Top