Insert new worksheet from template in macro


Posted by Barry ward on August 09, 2001 7:41 AM


I want data produced by a macro to be written to a new worksheet in standard format

Posted by Joe Was on August 09, 2001 11:15 AM

Sub mySheetData()
'
'By Joe Was

'This adds a sheet and names it "Test."
Sheets.Add.Name = "Test"

'This selects your new sheet and moves it after sheet "Sheet3," which could be any sheet name.
Sheets("Test").Select
Sheets("Test").Move After:=Sheets("Sheet3")

'this selects the sheet with the data and its range.
Sheets("Sheet1").Select
Range("A1:A7").Select

'This will copy and paste the data to your new sheet "Test."
Selection.Copy
Sheets("Test").Select
ActiveSheet.Paste

'At this point your data will be on the new sheet and selected for the next step.

End Sub


Hope this helps. JSW



Posted by barry ward on August 13, 2001 2:45 AM

thanks.....

By Joe Was 'This adds a sheet and names it "Test."