Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi and thanks in advance for your help,
I have the following code which is meant to get two different pieces of data from two different worksheets in the same workbook:
It seems to work fine for TBhistory but it only gets data from column A on the "Interpretations" worksheet.
I've tripple checked the value in the Interpretations worksheet to make sure they are right.
Many thanks in advance for any help,
Mike
I have the following code which is meant to get two different pieces of data from two different worksheets in the same workbook:
Code:
Private Sub CBanswer_Click()
Dim s As Worksheet, myValue As String, f As Range
Dim Q As Worksheet
Dim myvalue2 As String
Dim p As Range
Set s = Worksheets("Lists")
myValue = Comboxmajor.Value
Set f = s.Range("K1:K500").Find(myValue, LookIn:=xlValues, lookat:=xlWhole)
If Not f Is Nothing Then
TBhistory.Value = f.Offset(0, 1).Value
Else
MsgBox "Does not exists : " & myValue
End If
Set Q = Worksheets("Interpretations")
myvalue2 = Comboxmajor.Value & " " & Comboxarea.Value
Set p = Q.Range("A:A").Find(myvalue2, LookIn:=xlValues, lookat:=xlWhole)
If Not p Is Nothing Then
TBanswer.Value = p.Offset(0, 1).Value
Else
MsgBox "Does not exists : " & myvalue2
End If
End Sub
It seems to work fine for TBhistory but it only gets data from column A on the "Interpretations" worksheet.
I've tripple checked the value in the Interpretations worksheet to make sure they are right.
Many thanks in advance for any help,
Mike