View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Franz Verga Franz Verga is offline
external usenet poster
 
Posts: 459
Default How to work with macro in background

Jared wrote:
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