tags:

views:

15

answers:

1

I am tring to save textbox value in the new worksheet each time I click on command button and name the sheets as day1, day2,day3 so on .I tried different way , i dont know if it is possible or not .i will appreciate if someone piont me to right direction .

A: 

Here's a sample piece of code demonstrating the basic functions.

Private Sub CommandButton1_Click()
Dim WB As Workbook, SH As Worksheet, FN As String

    Set WB = Workbooks.Add                      ' create a new workbook
    Set SH = WB.Sheets(1)                       ' use first sheet
    FN = "SH " & Format(Now(), "YYYY-MM-DD")    ' construct a file name from current date
    SH.[A1] = Me.TextBox1                       ' write textbox value into cell A1
    WB.SaveAs FN, xlExcel7                      ' save new workbookas Excel7 format
    WB.Close                                    ' close workbook
    Me.Hide                                     ' close dialog window
End Sub

Hope this helps

Good luck - MikeD

MikeD