Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all, I got some fantastic help on this problem yesterday and wanted to
see if someone could take a look at my code and possibly offer some suggestions. What I have is a sheet that users access to pull up customer information from another sheet. This code is attached to a form with a ComboBox (ComboBox1) and 3 TextBoxes (1,2,3) that will eventually allow the users to locate and change customer info. This code locates and fills in the TextBoxes' information based upon the record displayed in The ComboBox. I can change the information in the TextBoxes, but the new info added right now only changes for TextBox1. Once I place the focus back onto ComboBox1, the information reverts back to what was originally there. Now that I've confused everyone, here's the code. TextBoxes 2 & 3 are not updating the sheet with the new info. Any Thoughts? Private Sub ComboBox1_Change() Dim res As Variant Set ws1 = Worksheets("Customer Database") ws1.Activate With ws1 res = Application.Match(ComboBox1.Value, Range("A:A"), 0) If IsError(res) Then MsgBox ComboBox1.Value & " Not Found" Else For i = 1 To 3 Me.Controls("TextBox" & i) = .Cells(res, i + 1) Next i End If End With End Sub Private Sub CommandButton1_Click() Dim res As Variant Set ws1 = Worksheets("Customer Database") ws1.Activate With ws1 res = Application.Match(ComboBox1.Value, Range("A:A"), 0) If IsError(res) Then MsgBox ComboBox1.Value & " Not Found" Else For i = 1 To 3 If Me.Controls("TextBox" & i) < "" Then .Cells(res, i + 1) = Me.Controls("TextBox" & i).Value Next i End If End With End Sub Any help would be appreciated! Thanks!! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Months of review | Excel Worksheet Functions | |||
vba code to block review toolbar | Excel Programming | |||
Change the interior color of a cell - Code Review | Excel Programming | |||
code that might be causing error - please review and comment | Excel Programming | |||
VB6 with Excel Objects: Please review my code | Excel Programming |