Is it possible to find a row with 2 criteria? I'm importing survey anwsers to a worksheet, now I want to find the answers of a specified person
I need to find the row in the worksheet(ImportLimesurvey) that has 2 specified cell values:
In that row:
The correct row has to be pasted to (Worksheets("Dataimport").Range("A7")
This is my current code:
The problem here is that he finds the row with the right account number, but the answer with the C-value isn't always the highest. It picks (logically) just the first row with that accountnumber. So how can I find the row that matches those 2 criteria?
Thanks in advance
P.S. I'm new to VBA so I tried to be as specific as possible but if you need any additional info, just ask for it
I need to find the row in the worksheet(ImportLimesurvey) that has 2 specified cell values:
In that row:
- the value of the C-cell has to be one of the highest value in that column (I used the function
VBA Code:
Application.WorksheetFunction.Max(rng)
- the value of the L-cell has to be the same as the cell (Worksheets("Dataimport").Range("M2")
The correct row has to be pasted to (Worksheets("Dataimport").Range("A7")
This is my current code:
VBA Code:
Dim g As Range
Dim rng As Range
Set rng = Worksheets("ImportLimesurvey").Range("C:C")
d = Application.WorksheetFunction.Max(rng)
With Worksheets("ImportLimesurvey").Range("L:L")
Set g = .Find(Worksheets("Dataimport").Range("M2"), LookIn:=xlValues)
g.Activate
End With
e = Range("C" & (ActiveCell.Row))
If e = d Then
ActiveCell.EntireRow.Copy _
Destination:=Worksheets("Dataimport").Range("A7")
End If
The problem here is that he finds the row with the right account number, but the answer with the C-value isn't always the highest. It picks (logically) just the first row with that accountnumber. So how can I find the row that matches those 2 criteria?
Thanks in advance
P.S. I'm new to VBA so I tried to be as specific as possible but if you need any additional info, just ask for it