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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
6,672
Office Version
  1. 2019
Platform
  1. Windows
try changing that line for this

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

and see if resolves

Dave
 

lockarde

Board Regular
Joined
Oct 23, 2016
Messages
77
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....
 

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
1,091
Office Version
  1. 2010
Platform
  1. Windows
Microsoft just updated my computer this morning, including things for my Office 2010, so perhaps it's an update that now picks it up.
 

lockarde

Board Regular
Joined
Oct 23, 2016
Messages
77
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
 

Forum statistics

Threads
1,136,968
Messages
5,678,866
Members
419,787
Latest member
juanam

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
Top