+ Reply to Thread
Results 1 to 6 of 6

Hide Sheets - Maco won't work!

  1. #1
    Registered User
    Join Date
    10-02-2007
    Location
    Charlotte, NC
    Posts
    31

    Hide Sheets - Maco won't work!

    I have a workbook with 4 sheets. Sheets 3/4 has formulas. When sheets 1/2 are formatted with data, I run the macro and it will pull the formulas into sheets 1 and 2 at desinated cells. This macro works fine if all 4 sheets/tabs are visible.

    However when sheets 3 and 4 are hidden the macro does not work. Macro error message box reads:

    "Run-time error '1004': Select method of Worksheet class failed"

    The spreadsheet is used by various departments and I really don't want sheets 3 and 4 to be visible. I tried to hide it but the macro won't work. Also I dragged the scroll bars to hide it but it still appears when I click on sheets 1or 2

    Is there a way around it?

    Thanks.
    Novice.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    The error comes in when you try to select a hidden worksheet. Since it is hidden, you cannot select it. There is almost always a work-around for selecting any cells or worksheets. So instead of selecting, just reference it.

    For example, instead of:
    Please Login or Register  to view this content.
    try:
    Please Login or Register  to view this content.
    HTH

    Jason

  3. #3
    Registered User
    Join Date
    10-02-2007
    Location
    Charlotte, NC
    Posts
    31
    Sub RUN()

    Sheets("KIKI").Select
    Columns("J:K").Select
    Selection.COPY
    Sheets("Sheet4").Select
    Range("J1").Select
    ActiveSheet.Paste
    End Sub
    How do I change this?

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    My example above shows you exactly how to change it...
    Please Login or Register  to view this content.
    Jason

  5. #5
    Registered User
    Join Date
    10-02-2007
    Location
    Charlotte, NC
    Posts
    31
    It worked excellent! Thank you!

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    You're welcome.

    Jason

+ 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