Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's the code:
Private Sub CommandButton1_Click() Dim lastRow As Object Set lastRow = Sheet1.Range("a65536").End(xlUp) lastRow.Offset(1, 0).Value = TextBox1.Text lastRow.Offset(1, 1).Value = TextBox2.Text lastRow.Offset(1, 2).Value = TextBox3.Text MsgBox "One record written to Sheet1" response = MsgBox("Do you want to enter another record?", _ vbYesNo) If response = vbYes Then TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox1.SetFocus Else Unload Me End If End Sub Private Sub CommandButton2_Click() End End Sub Private Sub btnPrevious_click() If ActiveCell.Column < 1 Then Cells(ActiveCell.Row, 1).Select End If If ActiveCell.Row < 1 Then ActiveCell.Offset(-1, 0).Select TextBox1.Text = ActiveCell.Value TextBox2.Text = ActiveCell.Offset(1, 1).Value TextBox3.Text = ActiveCell.Offset(1, 2).Value End If End Sub Private Sub btnNext_click() Dim lastRow As Long If ActiveCell.Column < 1 Then Cells(ActiveCell.Row, 1).Select End If If ActiveCell.Row < lastRow Then ActiveCell.Offset(1, 0).Select TextBox1.Text = ActiveCell.Value TextBox2.Text = ActiveCell.Offset(1, 1).Value TextBox3.Text = ActiveCell.Offset(1, 2).Value End If End Sub As one can tell, it's from Microsoft's help center. As you can see, have the previous and next buttons added. Is there a way to add a "Update button" so that I can update the data in those cells from thi form? I would like to do something like this: Private Sub btnUpdate_click() end sub But I don't know the code on how to. Can somebody lead me in the righ direction on how to write the code. I have done searches on this sit and have not really come up with anything helpful. Any help is appreciated marty -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to assign macro coding into customized button? | Excel Discussion (Misc queries) | |||
How do I add a tooltip to an Excel toolbar button without coding? | New Users to Excel | |||
Coding a Save button............ | Excel Discussion (Misc queries) | |||
need a button for each row to create a graph for the data | Charts and Charting in Excel | |||
Coding a button or hyperlink to insert a predfined row | Excel Programming |