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 total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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