Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code

Status
Not open for further replies.

paulasky220

Technical User
Jul 1, 2010
6
US
What's the code so that you can't see the macro as it's running and also the code so that you can run a macro after hiding worksheets
 



Hi,

Do you mean the code that keeps the sheet from moving all over the place?
Code:
sub Yourmacro
application.screenupdating = false
'your code
application.screenupdating = true
end sub
Any macro can be run if sheets are hidden. I don't understand.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,
Thanks for the code. That's the one I need.

I'm recorded the below macro and then hid the worksheets and then tried to run the macro again but it won't work cause the worksheets are hidden.
Is there a code to unhide each of the worksheets so it can run?
Thanks for your help. I'm really new at all this! :)

'
Range("A1").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"(All)"
Columns("A:O").Select
Selection.Copy
Sheets("All Regions").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"Carribean"
Application.CutCopyMode = False
Selection.Copy
Sheets("Caribbean").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"Central"
Application.CutCopyMode = False
Selection.Copy
Sheets("Central").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
Range("B1").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"Florida"
Application.CutCopyMode = False
Selection.Copy
Columns("A:N").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Florida").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"Northeast"
Application.CutCopyMode = False
Selection.Copy
Sheets("Northeast").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"South"
Application.CutCopyMode = False
Selection.Copy
Sheets("South").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"West"
Application.CutCopyMode = False
Selection.Copy
Sheets("West").Select
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("PercentAdvPivot").Select
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable85").PivotFields("Region").CurrentPage = _
"(All)"
Application.CutCopyMode = False
Sheets("PercentAdvPivot").Select
Range("A1").Select
Application.Goto Reference:="PercentAdv"
End Sub
 


That's because you cannot SELECT a hidden sheet.

If you use the screnupdating method, you can make the sheet visible, run your code and then make the sheet hidden and no one will know. ;-)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top