Runtime error '9'

Radsy

New Member
Joined
Jul 1, 2011
Messages
2
Hi everyone. New to the forum and excel. I am having problems with runtime error '9' subscript out of range. The sheet is used to organize horse racing ratings for the day. I did not create this and it was working for the past week. Then I tried to run it this morning and kept coming up with the runtime error. Any help would be appreciated.

End If
End If
If Right(Sheets("Horse").Cells(A, B), 2) = "am" Then
Sheets("Horse").Cells(A, B) = Left(Cells(A, B), Len(Sheets("Horse").Cells(A, B)) - 2)
End If
If Right(Sheets("Horse").Cells(A, B), 3) = "am " Then
Sheets("Horse").Cells(A, B) = Left(Cells(A, B), Len(Sheets("Horse").Cells(A, B)) - 3)
End If
If Sheets("Horse").Cells(A, B) <> vbNullString Then
Races(C) = Sheets("Horse").Cells(A, 1) & Sheets("Horse").Cells(X - 1, B).Text
Time(C) = Sheets("Horse").Cells(A, B)
C = C + 1
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
To me, this range reference looks wierd:

Cells(A, B)

Maybe you mean something else unlesss those are variables, which if so are the last variables you'd want to set for ranges with column letters confusingly looking like those.

Maybe also your sheet named Horse is really named "Horse " or " Horse" with an invisible and seemingly non-existent spacebar character but which would mean something different to VBA than "Horse".

I bet it's the cell ref though...looks fishy. aybe you want Cells("A", 1) or Cells(1, "A").
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,544
Members
452,925
Latest member
duyvmex

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