Hello!
I am trying to come up with a code that does the following things:
I have two sheets, sheet "RESUMO" and sheet "Gran.Solos NLT 10491".
Each sheet has a cell named "Sample" next to which the sample number is written.
In sheet resumo there is a column full of sample numbers, and I need for the other sheet to find the row with the same sample number it has and copy the information on the cell from that row and column G, and paste it on cell B4 from the other sheet.
Private Sub Worksheet_Change(ByVal target As Range)
Dim sh1 As Worksheet, sh2 As Worksheet, LR As Long
Set sh1 = Sheets("RESUMO")
Set sh2 = Sheets("Gran.Solos NLT 10491")
LR = sh1.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
If Not Intersect(target, Range("C27:C" & LR)) Is Nothing Then
If target.Value = sh2.Cells("B4").Value Then
sh2.Cells("B5").Value = sh1.Cells("i,G").Value
Else
sh2.Cells("B5").Value = ""
End If
End If
End Sub
This code does nothing, can anyone help me fix it? Thanks
I am trying to come up with a code that does the following things:
I have two sheets, sheet "RESUMO" and sheet "Gran.Solos NLT 10491".
Each sheet has a cell named "Sample" next to which the sample number is written.
In sheet resumo there is a column full of sample numbers, and I need for the other sheet to find the row with the same sample number it has and copy the information on the cell from that row and column G, and paste it on cell B4 from the other sheet.
Private Sub Worksheet_Change(ByVal target As Range)
Dim sh1 As Worksheet, sh2 As Worksheet, LR As Long
Set sh1 = Sheets("RESUMO")
Set sh2 = Sheets("Gran.Solos NLT 10491")
LR = sh1.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
If Not Intersect(target, Range("C27:C" & LR)) Is Nothing Then
If target.Value = sh2.Cells("B4").Value Then
sh2.Cells("B5").Value = sh1.Cells("i,G").Value
Else
sh2.Cells("B5").Value = ""
End If
End If
End Sub
This code does nothing, can anyone help me fix it? Thanks