VBA Set command throwing up Run-time error 9

kctronic

New Member
Joined
Jun 10, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Good day, I have had a workbook that i have been using for the past 8 months. Suddenly in the past 24 hours the VBA command line below began throwing up Run-time error 9. All workbooks exist and this error is occurring across a lot of similar workbooks i use. Was it an update? How can i fix this issue?

Dim credi As Worksheet: Set credi = Workbooks("TestWorkbook").Sheets("Credi")
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi & welcome to MrExcel.
You need to add the file extension to the end of the workbook name.
 
Upvote 0
Solution
You're welcome & thanks for the feedback.

I suspect that your explorer settings changed, if you have "Hide known file extensions" checked then you don't need to use the extension (although it's best to always include it), however if it is unchecked then you must always include the extension.
 
Upvote 0
For some weird reason file extensions are displayed though the "Hide known file extensions" is checked. Started after a recent OS update. Working with file extensions in the VBA would do. Thanks once again!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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