View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default (DAVE PETERSON) - SAVE WORKSHEET AS A NEW WORKBOOK

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Option Explicit
Sub testme()
dim wks as worksheet
'change this to the worksheet that you need to copy
set wks = worksheets("somesheetnamehere")

wks.copy 'copies to a new workbook--single sheet

'save the newly created single sheet workbook.
with activeworkbook
'change the C:\... to a real, existing location with a valid filename
'like
.saveas filename:="C:\my documents\myfilename.xls", _
fileformat:=xlworkbooknormal
.close savechanges:=false
end with
End Sub

(I added another parameter to the .saveas line in this version.)

Gator Girl wrote:

DAVE PETERSON SAYS TO USE THIS: BUT HOW DO I SET IT UP? ALT-F11 and THEN
WHAT?
dim wks as worksheet
set wks = worksheets("somesheetnamehere")
wks.copy 'copies to a new workbook--single sheet
'save the newly created single sheet workbook.
with activeworkbook
.saveas filename:="C:\..."
.close savechanges:=false
end with


--

Dave Peterson