+ Reply to Thread
Results 1 to 3 of 3

How to work with macro in background

Hybrid View

  1. #1
    Jared
    Guest

    How to work with macro in background

    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

  2. #2
    Franz Verga
    Guest

    Re: 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



  3. #3
    Jared
    Guest

    Re: How to work with macro in background

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

    You are the man

    Jared

    "Franz Verga" wrote:

    > 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
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1