How to work with macro in background

G

Guest

I have a hidden worksheet.
I try to use the data on it with a macro but it will not allow me. So i
unhid the sheet in the macro and when it finished the task i hid it back.

The problem is that I am able to see the sheet while i run the macro.
There are two solutions: 1. How can i operate a macro on a hidden sheet?
2. How can i run a macro in the background?

Please help.
Jared
 
F

Franz Verga

Jared said:
I have a hidden worksheet.
I try to use the data on it with a macro but it will not allow me. So
i unhid the sheet in the macro and when it finished the task i hid it
back.

The problem is that I am able to see the sheet while i run the macro.
There are two solutions: 1. How can i operate a macro on a hidden
sheet?
2. How can i run a macro in the
background?

Please help.
Jared

Hi Jared,

Two solutions:

1) the simplest: insert this line of code before unhiding the sheet:

Application.ScreenUdating = False

' here your code on your sheet
' then hide again the sheet then insert this line of code

Application.ScreenUpdating = True

2) a little bit more difficult: you can work on an hidden sheet without
selecting anything, e.g.:

instead of this code:

Worksheet("Hidden").Select
Range("A1").Select
Range("A1").Value = 2*Range("A1").Value

you can use:

With Worksheet("Hidden")
.Range("A1").Value = 2*.Range("A1").Value
End With

--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy
 
G

Guest

Thank you!
I think i will stick with the simple version but it is always good knowing
the alternative

You are the man

Jared
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top