Strip single macro after running.

joefrench

Active Member
Joined
Oct 4, 2006
Messages
357
I have a workbook with many macros that need to run throughout the life of the workbook. However, I have one macro that runs on Workbook open that I only need for the initial run of the workbook. The workbook does an automatic saveas after the macro in question is run which gets me to a point where I no longer need/want the macro. Does anyone have a way to strip just that macro in question after it is run?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi Joe,
Glad you got your problem solved.
Care to post what you did to solve it? I can think of a few ways to deal with something like
that but I'm sure somebody with a similar need searching through here in the future may be
able to benefit from what you've done.
 
Upvote 0
Work around

The macro that I wanted to run only once was an Input box that wrote a text string to a cell. My work around was to write as follows:

Code:
Private Sub ****()
If IsEmpty("cell which the input box wrote the text string to")
 
"single run macro"
"other code"
Else

"other code"

End If
End Sub

I am sure there are many ways to deal with this problem. This way is pretty simple and works well.

Joe :LOL:
 
Upvote 0
Yep, that's about as simple as it gets and, (depending on the complexity of your
run-once code), would've been my first suggestion. :biggrin:

Thanks.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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