View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bibio_ bibio_ is offline
external usenet poster
 
Posts: 1
Default print and save a single sheet from a workbook using a commandbutt.

Hi all, i would like to be able to save a single sheet from a workbook using
a command_button to a prealocated folder on a harddrive. at the moment it is
saving the whole workbook. i just want to save the sheet. (some code i have)

Private Sub CommandButton1_Click()
Dim namesheet

Sheet1.Range("B1").Value = Sheet7.Range("I11").Value

Sheet8.Range("I11").Value = Sheet1.Range("B1").Value + 1

Sheet1.Range("B1").Value = Sheet7.Range("I11").Value

Sheet7.Range("I11").Value = Sheet8.Range("I11").Value

namesheet = " - " & Sheet8.Range("I11").Value

Sheet7.SaveAs Sheet1.Range("B2").Value & ".xls"

Sheet8.SaveAs Sheet1.Range("B3").Value & namesheet & ".xls"

Sheet8.SaveAs Sheet1.Range("B2").Value & namesheet & ".xls"

Sheet8.PrintPreview

End Sub

i'm new at this so any help would be great.