How to comment/uncomment vba code using VBA Code

Hi ,
Problem statement : We are having a UDF in our EXCEL 2016 and a subroutine. UDF at present commented. After execution of few lines in subroutine we want to uncomment UDF using vba code only.

Please suggest whether it is possible using code, if it is then would request to provide code for the same.

Vishal G. B.
Vishal BharakhadaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Uncommenting code using VBA is not possible. You could however create a global Boolean variable in VBA called, say, gbSkip which you would initially set to True, and then in the UDF add this as the first line:
If gbSkip = True then Exit Function
When you want to "uncomment" the UDF, set gbSkip to False.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Why not simply use conditional code such as If-Then and/or Exit Sub statements to call the UDF only when needed?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.