Need a little help coping a sheet from one workbook to another.
Hi Brian,
I am assuming that you want the copied worksheet name in the new workbook
the same as the new workbook name. If this is correct then try the following.
Note that a space and underscore at the end of a line is a line break in an
otherwise single line of code.
Dim wbA As Workbook
Dim wbNew As Workbook
'Dim SheetsInWb
With Application
'Following line appears superfluous
'SheetsInWb = .SheetsInNewWorkbook
.SheetsInNewWorkbook = 1
.DisplayAlerts = False
.ScreenUpdating = False
End With
Set wbA = ThisWorkbook
Set wbNew = Workbooks.Add
With wbNew
.SaveAs Filename:="V:\CSPR\PW_CRAD_C.csv"
End With
wbA.Sheets("C").Copy _
Befo=wbNew.Sheets(1)
'Rename sheet in new workbook
wbNew.ActiveSheet.Name = "PW_CRAD_C"
'Delete superfluous sheet in new workbook
wbNew.Sheets("Sheet1").Delete
--
Regards,
OssieMac
|