Suddenly getting Subscript out of Range error

lockarde

Board Regular
Joined
Oct 23, 2016
Messages
77
Good morning all,

I have a spreadsheet that I've used for several weeks - it worked just fine yesterday in fact. Today I turned my computer on, opened the workbook, and suddenly I'm getting a Subscript out of Range error for the following line:
VBA Code:
With ThisWorkbook.Sheets("Job Results")
''some code
Set findcush = .Range("E20:E50").Find("Cushioning", LookIn:=xlWhole) ''error on this line
''some more code
End With

As I said, I literally just opened it, so I haven't made any changes to Sheet name, or anything. I read another post that said try referring to the Sheet via code name, in this case would be Sheet1. I still get the error. Any thoughts on this? I'm very confused - any help is greatly appreciated!

lockarde
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try changing that line for this

Rich (BB code):
Set findcush = .Range("E20:E50").Find("Cushioning", LookAt:=xlWhole)

and see if resolves

Dave
 
Upvote 0
try changing that line for this

Rich (BB code):
Set findcush = .Range("E20:E50").Find("Cushioning", LookAt:=xlWhole)

and see if resolves

Dave
Welp, that worked! Thanks, Dave! I realize now that I had incorrect syntax in there - so that begs the question, why has it been working until today? Probably a Monday question though....
 
Upvote 0
Microsoft just updated my computer this morning, including things for my Office 2010, so perhaps it's an update that now picks it up.
 
Upvote 0
Microsoft just updated my computer this morning, including things for my Office 2010, so perhaps it's an update that now picks it up.
Certainly could be the case - probably for the best, since it's catching my bad syntax. Thanks for the response NoSparks
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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