How to work on a new worksheet
Hi vkfuri-
I think you just need to make the workbook you add the "Active" workbook.
Workbooks(Workbooks.Count).Activate
You may also need to change Sheet1 to ActiveSheet.
John
"vkfuri" wrote:
Im trying to work on a new worksheet using workbooks.add, but when i
try to put some data on this new workbook, the data fills the original
workbook, where my macro is.
this is my macro:
cenario = Sheet1.Range("cdimportacao")
Workbooks.Add
Dim hoje As Date
Dim sfilename As String
sfilename = Format(Now(), "ddmmyyyy")
hoje = Format(Now(), "dd/mm/yyyy")
data = "DATA"
Sheet1.Cells(1, 1).Value = data
Sheet1.Cells(1, 2).Value = hoje
Sheet1.Range("A1:E2545").Value = cenario
ActiveWorkbook.SaveAs Filename:="c:\place\" & sfilename, _
FileFormat:=xlText, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Can someone help me with this? Appears to be basic.
|