1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Unhide sheet, to run macro, then hide sheet

Discussion in 'Business Applications' started by gjrobbins, Feb 8, 2010.

Thread Status:
Not open for further replies.
  1. gjrobbins

    gjrobbins Thread Starter

    Joined:
    Jan 25, 2010
    Messages:
    30
    Hi

    I am looking for help on VBA to unhide a specific sheet to enable the macro to run, then once complete to rehide the sheet.

    Code I have so far is as follows:

    Application.ScreenUpdating = False
    Sheets("IRIS_JNL_W2.1").Select
    Range("A2:C500").Delete

    Sheets("IRIS_JNL_W2.1").Select
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[3]-'W2-1'!R[9]C[4]"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[1]"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "=""W2-1 - Jnl No.""&'W2-1'!R[9]C[-2]"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[3]-'W2-1'!R[9]C[4]"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[1]"
    Range("C2").Select
    ActiveCell.FormulaR1C1 = _
    "=IF('W2-1'!R[9]C[-2]="""",IRIS_JNL_W2.1!R[-1]C,""W2.1 - Jnl No.""&'W2-1'!R[9]C[-2])"
    Range("A2:C2").Select
    Selection.AutoFill Destination:=Range("A2:C500"), Type:=xlFillDefault
    Range("A2:C500").Select

    Last = Cells(Rows.Count, "A").End(xlUp).Row
    For i = Last To 1 Step -1
    If (Cells(i, "A").Value) = "0" Then
    Cells(i, "A").EntireRow.Delete
    End If
    Next i
    Columns("A:C").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Columns("A:A").Select
    Application.CutCopyMode = False
    Selection.NumberFormat = "0.00"



    ActiveWorkbook.Sheets("IRIS_JNL_W2.1").Copy


    Application.ScreenUpdating = True

    End sub

    The sheet I want to unhide and then hide on completion is ("IRIS_JNL_W2.1")

    Also, How do I sheets("IRIS_JNL_W2.1"). to sheet3? As sheet name may change and I want it to be dynamic.

    Thanks
     
  2. nesr

    nesr

    Joined:
    Nov 5, 2008
    Messages:
    51
    to hide
    worksheets ("IRIS_JNL_W2.1").Visible=False

    to show
    worksheets ("IRIS_JNL_W2.1").Visible=True

    Peace be upon you
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/901219

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice