Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Worksheet is not updated

hello all, i'm just a beginner at excel & vB so i could use some help
here. I've this code that allows me to enter some information through
a form and it should write to a row in the sheet. Even though it says
"a record has been added!", nothing appears on the sheet. Confused by
this! Will someone help me in this? Thanks!

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Worksheet is not updated

I'd change this (at least for testing):

MsgBox "One record written to Sheet1"
to
MsgBox "One record written to Sheet1 to row " & lastrow.Row + 1

Any chance your data is missing stuff from column A. Maybe you're going too far
up column A.

And you're using the codename for sheet1. Are you sure that you're looking at
the correct worksheet?



Rachael wrote:

hello all, i'm just a beginner at excel & vB so i could use some help
here. I've this code that allows me to enter some information through
a form and it should write to a row in the sheet. Even though it says
"a record has been added!", nothing appears on the sheet. Confused by
this! Will someone help me in this? Thanks!

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


--

Dave Peterson
Reply
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
Links to other worksheet not updated or showing #VALUE! jaysan3 Excel Worksheet Functions 13 October 5th 09 11:33 AM
This worksheet contains links that cannot be updated Bruce Excel Discussion (Misc queries) 4 January 31st 08 04:43 PM
Display date when worksheet last updated? Barrie Bowdler Excel Worksheet Functions 1 October 18th 06 09:33 AM
How do I enter updated data into Excel worksheet? JvonB Excel Worksheet Functions 0 August 29th 06 12:36 AM
worksheet last updated Frank Kabel Excel Programming 0 September 1st 04 04:15 PM


All times are GMT +1. The time now is 05:36 AM.

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

About Us

"It's about Microsoft Excel"