Subscript out of range

S

Stacy Haskins

Why am I getting a "subscript out of range" error in the
following code?

Sub CheckSplits()
Sheets("Attendance").Select
If Range("X1") = "T" Then
SplitsOff
AttendanceSplitsOnOff = True
End If
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Sheets("StudentInfo").Select <=****HERE****
If Range("X1") = "T" Then
SplitsOff
StudentInfoSplitsOnOff = True
End If
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
End Sub
 
V

Vasant Nanavati

Most likely because you don't have a visible sheet named "StudentInfo" in
the active workbook. Check for typos, leading/trailing spaces, etc. to make
sure that the spelling in the code is identical to the spelling on the tab.
 
S

Stacy Haskins

That doesn't seem to be the case. I have copied the line
from different procedures, and it works everywhere else.
Any other suggestions?
 
V

Vasant Nanavati

Well, I can't think of another reason. You might want to double check the
following:

1. Is the sheet visible (i.e., not hidden)?

2. Is the sheet in the active workbook?

3. Is your code in a standard module (i.e., not in a sheet or workbook
module)?

4. Have you double- and triple-checked the spelling for slight variations
that may not be immediately apparent?

Other than that, I'm out of ideas.
 
L

Leo Heuser

Stacy

You may have collected some "dirt" during
copying the line. Try deleting all empty space
to the left of the line or delete the whole line
and manually enter it again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top