New to VBA and Macros but am in need of one to perform a task.
My goal: if a particular cell in one sheet has an x, then two cells from that same row are copied to a new space row in another sheet.
More details:
If space G3 contains an x I want cells E3 and F3 copied to a second sheet at cell A25 and B25. I want this code to check every row in column G from row 3 to whenever I stop adding rows. I want every row that does have an x to place those copied cells below space A25-B25, or add above and move the first down, whatever is easier.
I did find code that is supposed to copy a whole row:
Sub Search_and_Move()
Dim sTemp As String
sTemp = Sheet3.Range("G3").Text
If InStr(1, sTemp, "x", vbTextCompare) Then Range("A3").EntireRow.Copy _
Destination:=Sheet2.Range("A25")
End Sub
I couldn't even get this to work. Not sure if the Sheet2 and Sheet3 needed to be named by the names I added to the tabs or if something else was the issue. Then I need to figure out how to just copy specific cells and paste into specific cells...
I am trying to use this as a learning experience. Thanks for any help you can provide.
My goal: if a particular cell in one sheet has an x, then two cells from that same row are copied to a new space row in another sheet.
More details:
If space G3 contains an x I want cells E3 and F3 copied to a second sheet at cell A25 and B25. I want this code to check every row in column G from row 3 to whenever I stop adding rows. I want every row that does have an x to place those copied cells below space A25-B25, or add above and move the first down, whatever is easier.
I did find code that is supposed to copy a whole row:
Sub Search_and_Move()
Dim sTemp As String
sTemp = Sheet3.Range("G3").Text
If InStr(1, sTemp, "x", vbTextCompare) Then Range("A3").EntireRow.Copy _
Destination:=Sheet2.Range("A25")
End Sub
I couldn't even get this to work. Not sure if the Sheet2 and Sheet3 needed to be named by the names I added to the tabs or if something else was the issue. Then I need to figure out how to just copy specific cells and paste into specific cells...
I am trying to use this as a learning experience. Thanks for any help you can provide.