Hi,
I was able to figure out from an online video how to find a value in excel and report a value in the same row back into excel in a different workbook and cell.
Sub Findmg ()
Dim lastrow as Long
Dim Class as String
Dim rownumber as long
Dim LookInRange as Range
lastrow = ThisWorkbook.Sheets("Sheets1").Range("B" & Rows.Count).End(xlUp).Row
Class = "mg"
Set LookInRange = ThisWorkbook.Sheets("Sheet1").Range("B1:B" & lastrow).Find(What:=Class, LookIn:=xlValues)
rownumber = LookInRange.Row
ThisWorkbook.Sheets("Sheet2").Cells(3,3).Value = ThisWorkbook.Sheets("Sheet1").Cells(rownumber, 3).Value
End Sub
Is there anyway I can use the find next function. I have multiple "mg" values. I want to report each value back on sheet 2.
And, why do so many lines of code end in .Row? Does .Row pick the entire row or the row number the value was found in?
I was able to figure out from an online video how to find a value in excel and report a value in the same row back into excel in a different workbook and cell.
Sub Findmg ()
Dim lastrow as Long
Dim Class as String
Dim rownumber as long
Dim LookInRange as Range
lastrow = ThisWorkbook.Sheets("Sheets1").Range("B" & Rows.Count).End(xlUp).Row
Class = "mg"
Set LookInRange = ThisWorkbook.Sheets("Sheet1").Range("B1:B" & lastrow).Find(What:=Class, LookIn:=xlValues)
rownumber = LookInRange.Row
ThisWorkbook.Sheets("Sheet2").Cells(3,3).Value = ThisWorkbook.Sheets("Sheet1").Cells(rownumber, 3).Value
End Sub
Is there anyway I can use the find next function. I have multiple "mg" values. I want to report each value back on sheet 2.
And, why do so many lines of code end in .Row? Does .Row pick the entire row or the row number the value was found in?