Hi all
Please, I am in need of some help with my code, I have recorded some code and have the basics which does work, once!
I have done this with excel - Hlookup and it works well but each time the text changes (daily) on the Master sheet all the other sheets change. That's why I thought vba with a button command would work better.
Basically I would like the vba to find the last text in sheet "Furnace 1", column A, find the matching text in sheet "Master" (could be any where from E5:N24). Copy the cell below the matching text in sheet "Master"and paste it into the cell next to the original text in sheet "Furnace 1", column B.
Then repeat this for the other sheet "Furnace 2", column A up until "Furnace 10" if there are any occurrences, if not then nothing to copy.
Many thanks for your help.
Below is my code.
Sub Macro1()
'
' Macro1 Macro
'
Sheets("FURNACE 1").Select
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & lastRow).Select
Cells.Find(What:="h1831", After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Sheets("Master").Select
Cells.FindNext(After:=ActiveCell).Activate
Range("E5").Select
Selection.Copy
Sheets("FURNACE 1").Select
Range("B4").Select
ActiveSheet.Paste
End Sub
Please, I am in need of some help with my code, I have recorded some code and have the basics which does work, once!
I have done this with excel - Hlookup and it works well but each time the text changes (daily) on the Master sheet all the other sheets change. That's why I thought vba with a button command would work better.
Basically I would like the vba to find the last text in sheet "Furnace 1", column A, find the matching text in sheet "Master" (could be any where from E5:N24). Copy the cell below the matching text in sheet "Master"and paste it into the cell next to the original text in sheet "Furnace 1", column B.
Then repeat this for the other sheet "Furnace 2", column A up until "Furnace 10" if there are any occurrences, if not then nothing to copy.
Many thanks for your help.
Below is my code.
Sub Macro1()
'
' Macro1 Macro
'
Sheets("FURNACE 1").Select
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & lastRow).Select
Cells.Find(What:="h1831", After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Sheets("Master").Select
Cells.FindNext(After:=ActiveCell).Activate
Range("E5").Select
Selection.Copy
Sheets("FURNACE 1").Select
Range("B4").Select
ActiveSheet.Paste
End Sub