RunRabbit13
New Member
- Joined
- Aug 29, 2014
- Messages
- 12
I was using this code which Andrew Poulsom posted back in 2002. http://www.mrexcel.com/forum/excel-...ations-code-copy-worksheets-paste-values.html It works great, but I want it in my own Personal Macro workbook. When I place the code in Personal it no longer works. It is only when the code is introduced as new to the workbook that it works. What am I missing/doing wrong?
Code:
Sub Test()
Dim Sh As Worksheet
For Each Sh In ThisWorkbook.Worksheets
If Sh.Visible = True Then
Sh.Activate
Sh.Cells.Copy
Sh.Range("A1").PasteSpecial Paste:=xlValues
Sh.Range("A1").Select
End If
Next Sh
Application.CutCopyMode = False
End Sub
Code:
Sub Test()
Dim Sh As Worksheet
For Each Sh In ThisWorkbook.Worksheets
If Sh.Visible = True Then
Sh.Activate
Sh.Cells.Copy
Sh.Range("A1").PasteSpecial Paste:=xlValues
Sh.Range("A1").Select
End If
Next Sh
Application.CutCopyMode = False
End Sub