Hi,
I am using the following code to copy a sheet from one workbook to another.
The name of the workbook highlighted in red is the workbook where the code is being run from and each month the name of the workbook will change i.e.
Oct08.xls
Nov08.xls
Dec08.xls
I would like to replace
with some kind of dynamic code that will get the current name of the workbook and put it in the quotes.
i.e. something like
is this possible ??
Regards
Paul
I am using the following code to copy a sheet from one workbook to another.
Code:
Private Sub cmdAppend_Click()
Workbooks.Open Filename:="D:\PaulsDocuments\Business\Customers\Rigid\OTIF\Data.xls"
Sheets("Sheet1").Visible = True
Sheets("tblData").Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
[b][COLOR=red]Windows("Oct08.xls").Activate[/color][/b]
Sheets("tblData").Select
Sheets("tbldata").Copy _
After:=Workbooks("Data.xls").Worksheets(Workbooks("Data.xls").Worksheets.Count)
Columns("N:N").Select
Selection.Delete Shift:=xlToLeft
ActiveSheet.Shapes("cmdCall").Select
Selection.Delete
Range("A2").Select
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Visible = False
Workbooks("Data.xls").Save
Workbooks("Data.xls").Close
Range("A2").Select
frmMacros.Hide
End Sub
The name of the workbook highlighted in red is the workbook where the code is being run from and each month the name of the workbook will change i.e.
Oct08.xls
Nov08.xls
Dec08.xls
I would like to replace
Code:
Windows("Oct08.xls").Activate
i.e. something like
Code:
Windows("WorkbookName").Activate
is this possible ??
Regards
Paul