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: 33
Default MsgBox Code Error

I have the following code in a Userform that uses VBA controls. The idea is
that the below code should copy the userform data to a worksheet.
Unfortunatey the code stops at the line - response = MsgBox("Do you want to
enter another record?",

In addition no entries are copied to the worksheet, can anyone give me a
nudge with this please?

Thanks,
Mickey



Private Sub CmdbuttonSubmit_Click()
Dim LastRow As Object

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

LastRow.Offset(1, 0).Value = ComboBoxPIN.Text
LastRow.Offset(1, 1).Value = TextBox1.Text
LastRow.Offset(1, 2).Value = TextBox2.Text
LastRow.Offset(1, 3).Value = TextBox3.Text
LastRow.Offset(1, 4).Value = TextBox4.Text
LastRow.Offset(1, 5).Value = TextBox5.Text
LastRow.Offset(1, 6).Value = TextBox6.Text
LastRow.Offset(1, 7).Value = TextBox7.Text
LastRow.Offset(1, 8).Value = TextBox8.Text
LastRow.Offset(1, 9).Value = ComboBoxArea.Text
LastRow.Offset(1, 10).Value = TextBox9.Text
LastRow.Offset(1, 11).Value = ComboBoxActivity.Text
LastRow.Offset(1, 12).Value = ComboBoxOffence.Text
LastRow.Offset(1, 13).Value = TextBox10.Text
LastRow.Offset(1, 14).Value = TextBox11.Text
LastRow.Offset(1, 16).Value = CheckBoxSDet.Value
LastRow.Offset(1, 17).Value = CheckBoxPOMAN.Value
LastRow.Offset(1, 18).Value = CheckBoxANPR.Value

MsgBox "One record written to Performance Indicator System"

response = MsgBox("Do you want to enter another record?", _
vbYesNo)

If response = vbYes Then
ComboBoxPIN.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
ComboBoxArea.Text = ""
TextBox9.Text = ""
ComboBoxActivity.Text = ""
ComboBoxOffence.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
CheckBoxSDet.Value = ""
CheckBoxPOMAN.Value = ""
CheckBoxANPR.Value = ""

ComboBoxPIN.SetFocus

Else
Unload Me
End If

End Sub
End Sub


 
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
Msgbox Code Help Please.... kmwhitt Excel Discussion (Misc queries) 5 September 21st 06 01:52 AM
VBA code using if then and msgbox snoopy Excel Discussion (Misc queries) 0 December 1st 05 08:48 PM
msgbox on error Ciara Excel Discussion (Misc queries) 6 May 26th 05 08:34 PM
inputbox msgbox error lost again Excel Programming 3 April 14th 04 07:56 PM


All times are GMT +1. The time now is 03:44 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"