meghanalissa
New Member
- Joined
- Jan 14, 2013
- Messages
- 20
I need to use vba to copy a worksheet and paste its values into a new workbook in Excel 2010. Then, paste formatting from the original. The problem arises when there are hidden rows. I know the below is not the most efficient way to do this, but I want to add a statement to it to get it to not show the hidden rows. I will completely revamp the code at a later time to be more efficient.
Code:
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="[URL="file://\\tr\EquityDebt\TreasRpt\Website\2012PP1.xlsx"]C:\user\New.xlsx[/URL]", _
FileFormat:=xlOpenXMLWorkbook, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ThisWorkbook.Activate
Sheets(Array("Sheet1")).Select
Sheets("Sheet1").Activate
Cells.Select
Selection.Copy
Windows("New.xlsx").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False