Copy Paste Data in different sheet

avinashraste

Board Regular
Joined
Mar 12, 2008
Messages
167
Dear All,

I have an excel sheet where I have data in Sheet 1, A3 to H3, I want to copy the data to Sheet 3, A3 to H3

Then,

Again, I start from Sheet 1, A3 to H3, different data set BUT

Now this new data set should be copied to Sheet 3, BUT in the next line i.e. Sheet 3, A4 to H4

And so on,

every time, I input the data in Sheet 1, A3 to H3, the data set should be copied in Sheet 3, A5 to H5, then A6 to H6 and so on...

please guide & help

AR
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
The easy way is to do this:

When your ready to copy the data to sheet3 double click on Range("A3")

The script will then copy your data to Sheet(3) just like you wanted.

Doing it this way the script knows exactly when your ready to copy the data.

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  10/9/2019  4:28:23 AM  EDT
Cancel = True
If Target.Address = Range("A3").Address And Target.Value <> "" Then
    Dim Lastrow As Long
    Lastrow = Sheets(3).Cells(Rows.Count, "A").End(xlUp).Row + 1
    Cells(Target.Row, 1).Resize(, 8).Copy Sheets(3).Cells(Lastrow, 1)
End If
End Sub
 
Upvote 0
The easy way is to do this:

When your ready to copy the data to sheet3 double click on Range("A3")

The script will then copy your data to Sheet(3) just like you wanted.

Doing it this way the script knows exactly when your ready to copy the data.

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  10/9/2019  4:28:23 AM  EDT
Cancel = True
If Target.Address = Range("A3").Address And Target.Value <> "" Then
    Dim Lastrow As Long
    Lastrow = Sheets(3).Cells(Rows.Count, "A").End(xlUp).Row + 1
    Cells(Target.Row, 1).Resize(, 8).Copy Sheets(3).Cells(Lastrow, 1)
End If
End Sub

Wow,

Fantastic solution. Thanks a lot. just a couple of things to understand

1. In sheet 3 the data is copied to B2 to I2 instead of A3 to H3
2. Can we make it on " ENTER Event " on H3 instead of "Double Click" on A3 ?
3. Can we make all these in sheet 1 ? Data in A3 to H3 & Copy Data to K3 to R3 in the same sheet

Regards
 
Last edited:
Upvote 0
Wow,

Fantastic solution. Thanks a lot. just a couple of things to understand

1. In sheet 3 the data is copied to B2 to I2 instead of A3 to H3
2. Can we make it on " ENTER Event " on H3 instead of "Double Click" on A3 ?
3. Can we make all these in sheet 1 ? Data in A3 to H3 & Copy Data to K3 to R3 in the same sheet

Regards
The script I provided copied the data to sheet(3)
Sheet 3, A4 to H4

Just like you asked for. I test all my scripts.

If you have hidden columns this may cause the problem
I used double click because it is a safer way to ensure your really ready to run the script.

But if you want that I can do that.

And now your saying copy to same sheet.

Why are you now changing your requirements

Do you have more changes to your requirements.

It's hard to help when users change their requirements.
 
Last edited:
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Script will run when you change value in Range("H3")
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/9/2019  8:38:36 AM  EDT
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
Application.EnableEvents = False
If Target.Address = Range("H3").Address And Target.Value <> "" Then
    Dim Lastrow As Long
    Lastrow = Cells(Rows.Count, "K").End(xlUp).Row + 1
    Cells(3, 1).Resize(, 8).Copy Cells(Lastrow, 11)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Try this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/9/2019  9:07:36 AM  EDT
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
Application.EnableEvents = False
If Target.Address = Range("H3").Address And Target.Value <> "" Then
    Dim Lastrow As Long
    Lastrow = Cells(Rows.Count, "K").End(xlUp).Row + 1
    If Lastrow < 3 Then Lastrow = 3
    Cells(3, 1).Resize(, 8).Copy Cells(Lastrow, 11)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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