uga_godawgs
asked on
How do you change the order tabs are copied and pasted when using VBA in MS Excel 2010?
Hi All!
I'm hoping there is an easy solution to my issue. I have the code below that is set to go through all sheets in my workbook and copy then paste special values into the same spot. However, my tab that has my pivot table data is getting copied prior to all the other tabs, so my get pivot formulas are erring out because the data is getting pasted as values before the other tabs. I am trying to find a way to have my pivot table copy and paste special *after* all my other tabs. Any thoughts? Here is the VBA I am using to cycle through the tabs:
Sub PasteValues()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
For Each wks In wb.Worksheets
wks.Cells.Copy
wks.Cells.PasteSpecial Paste:=xlValues
Next
End Sub
If this isn't clear, ask questions and I'll try to explain better. Thanks in advance for everyone's help!
- Dave
I'm hoping there is an easy solution to my issue. I have the code below that is set to go through all sheets in my workbook and copy then paste special values into the same spot. However, my tab that has my pivot table data is getting copied prior to all the other tabs, so my get pivot formulas are erring out because the data is getting pasted as values before the other tabs. I am trying to find a way to have my pivot table copy and paste special *after* all my other tabs. Any thoughts? Here is the VBA I am using to cycle through the tabs:
Sub PasteValues()
Dim wks As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
For Each wks In wb.Worksheets
wks.Cells.Copy
wks.Cells.PasteSpecial Paste:=xlValues
Next
End Sub
If this isn't clear, ask questions and I'll try to explain better. Thanks in advance for everyone's help!
- Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome. Sometimes it's a "forest-for-the-trees" thing...happens to me all the time.
-Glenn
-Glenn
ASKER
-Dave