Macro to copy and paste from one sheet to another in the same workbook

Johnzea

New Member
Joined
Apr 5, 2019
Messages
23
I have a single workbook with (2) sheet tabs as follows - (Plant Schedule Sheet) and (Master Plant Schedule Sheet)

(Master Plant Schedule Sheet)

https://imgur.com/bR68kqb

(Plant Schedule Sheet)

https://imgur.com/VUoAXSw

What i would like it to do is that whatever number you put in column 'A' row 1, 2, 3 etc on the (Plant Schedule Sheet) it will go to the (Master Plant Schedule Sheet) find the corresponding number then copy and paste the SYM, COMMON, BOTANICAL (QTY not needed) into the (Plant Schedule Sheet) where the number you type resides....

Thank you for any help....

Johnzea
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
The code would go in the Plant Schedule Sheet code module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Dim sh1 As Worksheet, sh2 As Worksheet, fn As Range
Set sh1 = Sheets("Master Plant Schedule Sheet")
Set sh2 = Sheets("Plant Schedule Sheet")
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Set fn = sh1.Range("A:A").Find(Target.Value, , xlValues, xlWhole)
            If Not fn Is Nothing Then
                Target.Offset(, 1) = fn.Offset(, 1).Value
                Target.Offset(, 3).Resize(, 2) = fn.Offset(, 3).Resize(, 2).Value
            End If
    End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top