VBA Copy and Paste

Zdavis123

New Member
Joined
May 26, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi there. Hoping you might be able to guide me in the right direction, been looking online and I'm not having any luck.
When data is entered in one worksheet im wanting to copy and paste that into another worksheet in the same cell references.
Eg where data is entered into worksheet1 in b5, to also populate it into b5 in worksheet2, and then b6 into b6, ect.
Can use easily reference the cells in worksheet2 to 1 but its slowing down my workbook. Could this be done easily in vba?
Any ideas? Ty!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the Board!

Yes, this can be done easily using VBA, assuming the data is being entered in manually and not the result of formulas or other outside links.
Do you want it to do this for the ENTIRE worksheet, or just specific columns and rows?"
If for specific columns and rows, let us know which ones.
 
Upvote 0
Hi Joe, yeah for all data entered manually into the sheet1 from b5 downwards into sheet2 b5 and then b6, b7, ect
What im hoping to do is then sort the dataset in sheet 2 based on descending order in column H based on a value identified from index/match.
I have the code to sort it and it works perfectly but getting the data from sheet 1 to 2 is a pain haha
 
Upvote 0
On Sheet1, right-click on the Sheet tab name at the bottom of the screen, select "View Code", and paste this VBA code in the VB Editor window that opens up:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if multiple cells updated at once
    If Target.CountLarge > 1 Then Exit Sub
    
'   See if update in column B after row 4
    If Target.Column = 2 And Target.Row > 4 Then
        Sheets("Sheet2").Range(Target.Address).Value = Target.Value
    End If

End Sub
It will now automatically write the values from column B below row to Sheet2, as they are entered, as long as one cell is being updated at a time (i.e. not using Copy/Paste to update many cells at once).
 
Upvote 0
Solution
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,321
Messages
6,124,239
Members
449,149
Latest member
mwdbActuary

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