excel copy and paste macro

Hayward

New Member
Joined
Jul 21, 2013
Messages
6
Hi guys I need to find a way to have a macro button to copy and paste form one cell and paste it into a table on the on second tab. on my first sheet I have column for our Customer Code Sheets("Data_Entry") B3 and one for QTY ("Data_Entry") C3 l like to copy and paste this to a table in a second tab called Sheets("Cust_History"). I have tried to record it with the macro recorder but just it just copied over the last entry. see my macro recording below..

Sub Enter()
'
' Enter Macro
'
' Keyboard Shortcut: Ctrl+q
'
Range("B3").Select
Selection.Copy
Sheets("Cust_History").Select
Range("B19").Select
ActiveSheet.Paste
Sheets("Data_Entry").Select
Range("C3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Cust_History").Select
Range("C19").Select
ActiveSheet.Paste
Sheets("Data_Entry").Select
Range("B3").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C3").Select
Selection.ClearContents
End Sub
I like it to move down to the empty cell below.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
For your particular task use
Rich (BB code):
Sub CopyMe()
    With Sheets("Sheet1").Range("B1:C1")
        .Copy
         Sheets("Cust_History").Range("B17").PasteSpecial Paste:=xlPasteAll, Transpose:=True
        .ClearContents
    End With
End Sub

In general to copy to next empty cell

Code:
[color=darkblue]Sub[/color] Macro2()
    [color=darkblue]Dim[/color] c [color=darkblue]As[/color] Range
    [color=darkblue]For[/color] [color=darkblue]Each[/color] c [color=darkblue]In[/color] Sheets("Sheet1").Range("B1:C1")
        c.Copy Sheets("Cust_History").Range("B" & Rows.Count).End(xlUp).Offset(1)
        c.Clear
    [color=darkblue]Next[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]

Change Sheet1 to the name of your sheet you are copying from
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,616
Members
449,238
Latest member
wcbyers

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