I'm looping through all the cells in a range and want to get the value of the cell in the same position in another range that's the same size when the cell value in the first range equals a certain value and insert it into another cell. I can't quite figure how to do this. Here's where I am
Code
Public Sub FindRelativeValue()
Dim valRange As Range, condRange As Range, cel As Range, foundCount As Integer, insRange As Range, timeRange As Range
Set valRange = Sheet1.Range("R19:AC26") ' these two are
Set condRange = Sheet1.Range("PlateMap") ' the same size
Set insRange = Sheet1.Range("BM22")
Set timeRange = valRange.Offset(, 67)
For Each cel In valRange
If condRange.Cells(cel.Row, cel.Column).Value = "DMSO" Then
insRange.Offset(foundCount).Value = timeRange.Cells(cel.Row, cel.Column).Value
insRange.Offset(foundCount, 1).Value = cel.Value
foundCount = foundCount + 1
End If
Next cel
End Sub
Display More