VBA 1004 Error when editing a cell

Dragonmann

New Member
Joined
Apr 26, 2010
Messages
14
Okay,

I think this should be an easy one, but my brain is fried already. :help:

I have a Macro that runs when the active sheet changes. I use it to populate pull downs on the sheet based on prior inputs.

However, if the active sheet changes while a cell is being edited, excel throws a 1004 error.

Users shouldn't be building formulas, and ABSOLUTELY have no need to build formulas that reference across pages.

All I need to do is accept the current state of the formula bar before activating the new sheet.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I'm not too sure but you might want to look for worksheets being locked while the code is being run.

I dunno but something like
Worksheets("Sheet1").Locked = True
at the start of the code

Worksheets("Sheet1").Locked = False
MsgBox "Successfully executed the macro"
at the end of the code
 
Upvote 0
I think that might wanna be

Code:
Sheets("MySheet").Unprotect "Password"

'...Code

Sheets("MySheet").Protect "Password"
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,910
Members
452,949
Latest member
beartooth91

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