I want CommandButton3 To Do What CommandButton2 Does
Manage your personal finances in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: I want CommandButton3 To Do What CommandButton2 Does

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hi,

    I have CommandButton2 & CommandButton3 on a MultiPage Control on a Form. Since the form is quite large, somtimes a user does not have to enter info for all of them. What I want to do is have Commandbutton3 which is on page 2 of multipage control update the worksheet the same way CommandButton2(page4)would. A sample of my code follows. I have left out some since the coding is a lot.

    Dim Lastrow as object

    Set LastRow = Sheet1.Range("a65536").End(xlUp)


    LastRow.Offset(1, 0).Value = Polno.Text
    LastRow.Offset(1, 1).Value = Claimno.Text

    Click CommandButton2 and get the following.

    MsgBox "One record written to Marine Claims"

    response = MsgBox("Do you want to add another record?", _
    vbYesNo)
    If response = vbYes Then

    Polno.Text = ""
    Claimno.Text = ""
    MultiPage1.Value = 0
    Polno.SetFocus

    Else
    For Each w In Application.Workbooks
    w.Save
    Next w
    Application.Quit

    End If
    End Sub

    Any help would be appreciated.

    Mareene

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    Sub Commandbutton3_Click()
    Commandbutton2_Click
    End Sub

    Tom

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks Tom,

    I did not think that it would have been so simple. There I was writing all sorts of coding to get it to work.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com