LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need help with data from coding....try to create an update button

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to assign macro coding into customized button? Eric Excel Discussion (Misc queries) 4 August 6th 09 01:35 AM
How do I add a tooltip to an Excel toolbar button without coding? Simple New Users to Excel 1 August 2nd 08 04:52 PM
Coding a Save button............ chadtastic[_5_] Excel Discussion (Misc queries) 2 September 5th 07 04:48 PM
need a button for each row to create a graph for the data Cheese Slice Charts and Charting in Excel 0 April 9th 06 02:36 PM
Coding a button or hyperlink to insert a predfined row Neal Miller Excel Programming 0 December 3rd 03 10:11 PM


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"