I'm very new to VBA but have gotten some good info from this forum. Thanks to all. My problem is in this section of code. I'm creating a single sheet workbook and naming it today's date. Then I copy a single sheet from an open workbook and want to paste it in the new workbook. I can't figure out how to activate the new workbook to facilitate the paste. See the line with asterisks. I need a variable to refer to the new workbook sheet since the file name will change every day. A book I have says you can use Workbook.Name to return the file name of a workbook but, I can't seem to figure it out. I'd appreciate any help. Thanks
' Copies DataLog sheet into new workbook and saves it with
' todays date as it's name
'Sheets("DataLog".Select
Workbooks.Add(xlWBATWorksheet).Activate ' Create a Workbook with 1 sheet
ActiveWorkbook.SaveAs ("C:\Data\TankChlor\" & Format(TodaysDate, "d-mmm-yy" & ".Xls"
' Go to original sheet and copy
Windows("TankChlor_Test1.xls".Activate
'Range("B6".Select
ActiveSheet.Unprotect ("unprotect"
Cells.Select
Selection.Copy
' How do I activate the new workbook to paste copied sheet?
*** Windows(new sheet name).Activate ***
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
'Range("B6".Select
Application.CutCopyMode = False
' Copies DataLog sheet into new workbook and saves it with
' todays date as it's name
'Sheets("DataLog".Select
Workbooks.Add(xlWBATWorksheet).Activate ' Create a Workbook with 1 sheet
ActiveWorkbook.SaveAs ("C:\Data\TankChlor\" & Format(TodaysDate, "d-mmm-yy" & ".Xls"
' Go to original sheet and copy
Windows("TankChlor_Test1.xls".Activate
'Range("B6".Select
ActiveSheet.Unprotect ("unprotect"
Cells.Select
Selection.Copy
' How do I activate the new workbook to paste copied sheet?
*** Windows(new sheet name).Activate ***
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
'Range("B6".Select
Application.CutCopyMode = False