Run Time 91 error on my computer, but not coworkers

Apples52

New Member
Joined
Sep 25, 2023
Messages
6
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I am using a template a coworker created that has a macro to clear the sheet, which works fine, and a second macro to run which copies data to another tab, which is not working for me. The macro runs as intended on my coworkers computer, but does not on my computer. I am getting a "Run time error 91: Object variable or with block variable not set" error. I've gone down a google rabbit hole trying to figure this out with no success. We are both on a windows computer using office suite 2019. See screenshot of the debug below. How can I fix this?


error 91.jpg
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello,
On your coworkers PC, from Visual Basic, click Tools, and then References, you will see a window that looks something like this.

1695671951113.png

Then go to your PC, and see if you have the same references checked "on". this might not be the problem, but it is the first place I would think to check.
 
Upvote 0
Look at the Find settings on both PC's, do they match? in particular look at Match entire cell contents
 
Upvote 0
Hello,
On your coworkers PC, from Visual Basic, click Tools, and then References, you will see a window that looks something like this.

View attachment 99266
Then go to your PC, and see if you have the same references checked "on". this might not be the problem, but it is the first place I would think to check.
I just compared our references and they are the same- thank you for the suggestion. The only thing I checked from a google search before posting was opening DCOMCnfg.exe and checking that local and remote access was set to allow for "everyone" (it was).

Quite frustrating and puzzling to me. I have about 50 other workbooks I regularly use that run macros fine on my machine and theirs- just don't understand why this one would be any different.
 
Upvote 0
Look at the Find settings on both PC's, do they match? in particular look at Match entire cell contents
Are you referring to the settings in the "Find and Replace" box? The one you open up by ctrl +F? Settings are the same there, but I'm also not searchign for something, so not quite sure how that would impact or relate to me running the macro. Unless I'm misunderstanding something?
 
Upvote 0
Closing the loop on this specific case. Turned out to be me running an older version of excel (2019). Had never been an issue with any other excel files until this one. Changed my settings to use the office 365 account I didnt' realize I hadn't been using and now its running as expected. Just wish I had thought of that about 12 working hours ago. Thanks all for your willingness to help.
 
Upvote 0
I seriously doubt that it was erring out because you were using 2019, more likely that your settings are different in the newer version.
It is often an issue when using Find as Find retains a memory on most of it's settings and so not setting the parameters in the code risks having issues.

In particular I suspect that the line needs to be
VBA Code:
 Set FoundCell = FindRange.Find("x*x", LookIn:=xlValues, LookAt:=xlPart)
I have removed the Offset(0, 0) as an offset of 0 rows and 0 columns does nothing
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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