Hi All,
Carrying on from my previous threads where I have asked for help populating a number of textboxes based on the results of 1 or 2 comboboxes, I am now in need of assistance with the following form:
I've deleted out personal details but to clarify:
In each frame there are between 4 and 7 textboxes on the left hand side containing the names of the various agents working for my company. What I am trying to achieve is when the combobox at the top of the form is populated and the "Retrieve" button is clicked, the correct results are populated from my main data sheet (entitled "QtrData").
Here is the original form I created and got to work (with some of your help)...
and here is the code used for this sheet (i've deleted out some that relates to conditional formatting as not relevant for this)..
However this only shows the results for 1 agent. The difficulty I have is that I need to match many text boxes with their corresponding results for the correct quarter given in the combobox and I'm not sure where to begin!
Can anyone help? I hope I've given you enough information but let me know if there's anything else you need to know...
Thanks
Carrying on from my previous threads where I have asked for help populating a number of textboxes based on the results of 1 or 2 comboboxes, I am now in need of assistance with the following form:
I've deleted out personal details but to clarify:
In each frame there are between 4 and 7 textboxes on the left hand side containing the names of the various agents working for my company. What I am trying to achieve is when the combobox at the top of the form is populated and the "Retrieve" button is clicked, the correct results are populated from my main data sheet (entitled "QtrData").
Here is the original form I created and got to work (with some of your help)...
and here is the code used for this sheet (i've deleted out some that relates to conditional formatting as not relevant for this)..
Code:
Private Sub CommandButton7_Click()
Dim criteria As String
Dim rng As Range
Dim result
criteria = ComboBox2.Text
If Trim(criteria) <> "" Then
result = Application.Match(criteria, Worksheets("QtrData").Range("B:B"), 0)
If Not IsError(result) Then
With Worksheets("QtrData")
TextBox53.Text = .Range("C:C")(result).Text
TextBox52.Text = .Range("D:D")(result).Text
TextBox51.Text = .Range("G:G")(result).Text
TextBox47.Text = .Range("K:K")(result).Text
TextBox43.Text = .Range("P:P")(result).Text
TextBox39.Text = .Range("T:T")(result).Text
TextBox35.Text = .Range("Z:Z")(result).Text
TextBox31.Text = .Range("AC:AC")(result).Text
TextBox50.Text = .Range("AF:AF")(result).Text
TextBox46.Text = .Range("AJ:AJ")(result).Text
TextBox42.Text = .Range("AO:AO")(result).Text
TextBox38.Text = .Range("AS:AS")(result).Text
TextBox34.Text = .Range("AY:AY")(result).Text
TextBox30.Text = .Range("BB:BB")(result).Text
TextBox49.Text = .Range("BE:BE")(result).Text
TextBox45.Text = .Range("BI:BI")(result).Text
TextBox41.Text = .Range("BN:BN")(result).Text
TextBox33.Text = .Range("BX:BX")(result).Text
TextBox29.Text = .Range("CA:CA")(result).Text
TextBox48.Text = .Range("CD:CD")(result).Text
TextBox44.Text = .Range("CH:CH")(result).Text
TextBox40.Text = .Range("CM:CM")(result).Text
TextBox36.Text = .Range("CQ:CQ")(result).Text
TextBox32.Text = .Range("CW:CW")(result).Text
TextBox28.Text = .Range("CZ:CZ")(result).Text
TextBox27.Text = .Range("DA:DA")(result).Text
TextBox54.Value = .Range("DB:DB")(result).Text
End With
Else
MsgBox "Unable to find reference"
End If
Else
MsgBox "Unable to find reference"
End If
End Sub
However this only shows the results for 1 agent. The difficulty I have is that I need to match many text boxes with their corresponding results for the correct quarter given in the combobox and I'm not sure where to begin!
Can anyone help? I hope I've given you enough information but let me know if there's anything else you need to know...
Thanks