Populating a userform from data in a sheet problem. Is it an Obvious error ??

C

Corey

I have created a userform where the user enters a variety of data into
various textboxes and comboboxes.
When the OK(Commandbutton) is clickded the values(data) is input into a
sheet.

What i want to do now enable a user to modify value/s that were entered
into the userform.
The original userform to input the values to the sheet is userform7.
So what i did was create a clone of the userform7, (userform8).
Now in the userform8 Intitialise area i placed this to try to populate the
values from the sheet into the userform:

Private Sub UserForm_Initialize()
With UserForm8
TextBox1.Value = UserForm7.ComboBox2.Value
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Combobox.Value
With workSheets("DespatchData").Range("A:A") ' <====== Sheet where userfor7
placed the values/data
Set rngFound = .Find(what:=ComboBox2.Value, after:=.Range("A1"),
LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows,
searchdirection:=xlNext, MatchCase:=False, matchbyte:=False)
UserForm8.TextBox2.Value = rngFound.Offset(-1, 3).Value ' <===== SEE below
AAA
End With
End With
End Sub


AAA:
This first textbox on userform8 (Textbox2) will NOT display the value that
is in sheet(DespatchData).
The offset(-1, 3) is correct, as the rngFound cell is in range(A2) and the
required value to be input into textbox2 is in cell (D1) IE. offset(-1, 3).

Is there something OBVIOUS i am missing here ?


Corey....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top