Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 01-05-2009, 02:58 AM   #1 (permalink)
Registered User
 
Join Date: Jan 2009
Posts: 1
OS: xp pro


Post VBA update spreadsheet

Hi

I'm working on a spreadsheet with contact details, Tel, Fax Contact name etc.

I have a userform that can populate the details from the spreadsheet

The Userform uses a combobox where the company can be selected and then the textboxes populates the contact details.

My problem is i want changes that are made in the textboxes to be saved to the spreadsheet.
eyedentity is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 01-05-2009, 06:55 PM   #2 (permalink)
Registered User
 
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 160
OS: Windows XP SP3


Re: VBA update spreadsheet

One way is to add a button to the UserForm that will transfer data from the TextBoxes to the spreadsheet.

For example, suppose you have a ComboBox named ComboBox1, and when you select a company name, a TextBox named Phone is filled with the corresponding phone number, which is stored in column C of the spreadsheet.

You can set up a CommandButton to transfer data from TextBoxes to the spreadsheet after data in the form's Phone field is entered or changed. Suppose the phone number for the first company name is in C1, the phone number for the second company name is in C2, and so on. Suppose the CommandButton is named UpdateButton. You can set up the button with code such as:

Code:
Private Sub UpdateButton_Click()
    Cells(ComboBox1.ListIndex + 1, 3).Value = Phone.Value
End Sub
Suppose the user has selected the second company name and changed the phone number. With the second item in the ComboBox selected, the ListIndex will be 1 (for the first item, it will be 0). The code adds 1 to the ListIndex to get the row where the data should be saved (in this example, row 2). Once the code determines the correct cell (C2 in this example), it will look at the data in the TextBox named Phone and put it in that cell.

Modify as necessary.

Last edited by David M58; 01-05-2009 at 06:56 PM.
David M58 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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




All times are GMT -7. The time now is 06:03 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85