Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Copy and paste data from hidden sheets

Posted on 2011-04-25
3
Medium Priority
?
149 Views
Last Modified: 2012-05-11
Hi Experts,

I would like to request Experts help to modify the attached script. Intent to hide sheet “Date” and “Chart” while running the code from “Update” sheet. Hope Experts will help me to add this feature .



Sub CopyA()
    Sheets("Date").Select
    Range("A3:B55").Select
    Selection.Copy
    Sheets("Chart").Select
    Range("B2").Select
    ActiveSheet.Paste
    Sheets("Update").Select
    Range("B41").Select
End Sub
Sub CopyB()
    Sheets("Date").Select
    Range("D3:E55").Select
    Selection.Copy
    Sheets("Chart").Select
    Range("B2").Select
    ActiveSheet.Paste
    Sheets("Update").Select
    Range("B41").Select
End Sub

Open in new window

0
Comment
Question by:Cartillo
3 Comments
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 200 total points
ID: 35459149
You can use
worksheets("yoursheet").visible = xlsheetveryhidden
or
worksheets("yoursheet").vislble = xlsheetVisible

Scott C

0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 1800 total points
ID: 35459209
Is this what you are trying?

Sub CopyA()
    With Sheets("Date")
        '<~~ Required as if the output sheet is hidden then the below
        '<~~ will give error if there are only 3 sheets
        Sheets("Output").Visible = True
        
        Sheets("Chart").Visible = False
        .Visible = False
        .Range("A3:B55").Copy Sheets("Chart").Range("B2")
    End With
End Sub

Sub CopyB()
    With Sheets("Date")
        '<~~ Required as if the output sheet is hidden then the below
        '<~~ will give error if there are only 3 sheets
        Sheets("Output").Visible = True
        
        Sheets("Chart").Visible = False
        .Visible = False
        .Range("D3:E55").Copy Sheets("Chart").Range("B2")
    End With
End Sub

Open in new window


Sid
0
 

Author Closing Comment

by:Cartillo
ID: 35460645
Hi,

Thanks for the help
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question