Copy data from one work sheet to another

kiwikiki718

Board Regular
Joined
Apr 7, 2017
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Hello how do I copy data from one work sheet to another based on a condition?

Ex. If worksheet 2 cell C3 = True, I want to copy data from worksheet 1 cells A3,A4,B3,B4 to worksheet 2 cells A3,A4,B3,B4. If the data is blank in worksheet 1 I want the data to also show blank in work sheet 2.

Note cell C3 is a checkbox

Thanks in advance
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I'm assuming C3's value is the state of the checkbox. This goes in Worksheet 2

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("C3").Address Then
    If Target = True Then
        Worksheets(1).Range("A3:B4").Copy
        Range("A3:B4").PasteSpecial xlPasteAll
    End If
End If

End Sub
 
Upvote 1
Solution
I'm assuming C3's value is the state of the checkbox. This goes in Worksheet 2

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("C3").Address Then
    If Target = True Then
        Worksheets(1).Range("A3:B4").Copy
        Range("A3:B4").PasteSpecial xlPasteAll
    End If
End If

End Sub
Thank you this worked.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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