Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2016, 12:36 PM
MisterChips MisterChips is offline Unable to get a User Form to write changes Windows 10 Unable to get a User Form to write changes Office 2016
Novice
Unable to get a User Form to write changes
 
Join Date: May 2016
Posts: 1
MisterChips is on a distinguished road
Default Unable to get a User Form to write changes

Sirs,
I am reasonable conversant with VBA in Access databases, but now have a need to create User Forms to make spreadsheets easier to update.
I have a problem with a User Form that I do not understand.
I have a number of text boxes on the user form that I populate from a worksheet.
Putting the data into the form’s textboxes works well , the data displays exactly as it is in the workbook, and the text boxes accept changes.
The intention is to change the data in the text boxes and write the changes back to the worksheet.
After making a change, I do this by clicking on a command button5 which runs the following snipped of code.



Private Sub CommandButton5_Click() ' SAVE button
MsgBox MO.Text ‘ First MsgBox
PutData
End Sub

Private Sub PutData()
MsgBox MO.Text ‘ Second MsgBox
Cells(r, 1).Value = LodgeNo.Text
Cells(r, 2).Value = LodgeName.Text
Cells(r, 3).Value = WM.Text
Cells(r, 4).Value = SW.Text
Cells(r, 5).Value = JW.Text
MsgBox MO.Text ‘ Third MsgBox
Cells(r, 6).Value = MO.Text
Cells(r, 7).Value = SO.Text
End sub

I am using MO.text as text box to investigate

The workbook cell has "Dave Parker" in it.
When loaded into the user form MO.text has “Dave Parker” in it.
I change the data to “John Smith” and click on button5 (save)
MsgBox one shows MO.Text as being “John Smith”
MsgBox two shows MO.Text as being “John Smith”
(Both of which I expect and am happy with)
MsgBox three, however, shows MO.Text as being “Dave Parker” (again)
…… and the worksheet cell remains “Dave Parker”
My question is what is wrong with my code that causes the data to revert to the original text in the worksheet?
.... rather than the udpdated text in the user form.
Reply With Quote
  #2  
Old 05-06-2016, 08:22 AM
NoSparks NoSparks is offline Unable to get a User Form to write changes Windows 7 64bit Unable to get a User Form to write changes Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Hey there MisterChips, why don't you post a sample workbook ?
We could then see what's actually happening instead of guessing.
Reply With Quote
Reply

Tags
user form write problem



Similar Threads
Thread Thread Starter Forum Replies Last Post
text box appears after I press enter/try to write in bullet form topgunitsme Word 1 08-13-2014 03:26 PM
write need help and copy write need help on another page auto wykoems Word 2 07-25-2013 07:56 AM
unable to view Microsoft add-in when login as normal user Cloud Ong Outlook 3 02-24-2012 03:12 AM
Unable to get a User Form to write changes Write to document from Access form NISMOJim Word 9 06-23-2011 02:29 AM
Unable to get a User Form to write changes Why unable to use underscore in microsoft word styles( user defined)? noufalcm Word 1 03-08-2011 01:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft