help fixing copy and paste vba code

jondavis1987

Active Member
Joined
Dec 31, 2015
Messages
443
Office Version
  1. 2019
Platform
  1. Windows
I have to keep making spreadsheets that pulls data from specific parts of worksheets. In this vba I'm trying to pull from Sheet 3012-EST-1604 cells F2:F15 and paste it on the active worksheet. Preferably to a cell that I have selected. I'm sure this is very basic, I just started working with this




Code:
Sub Hveem_B_Hanson()
'
' Hveem_B_Hanson Macro
'
' Keyboard Shortcut: Ctrl+Shift+B
'
    Sheets("3012-EST-1604").Select
    Range("F2:F15").Select
    Selection.Copy
    Sheets("activeWorksheet").Select
    Range("F2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Never mind I got it.

Code:
Sub Hveem_B_Hanson()
'
' Hveem_B_Hanson Macro
'
' Keyboard Shortcut: Ctrl+Shift+B
'
    Sheets("3012-EST-1604").Range("F2:F15").Copy
    ActiveSheet.Select
    ActiveCell.Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub
 
Upvote 0
Code:
Sub Hveem_B_Hanson()
'
' Hveem_B_Hanson Macro
'
' Keyboard Shortcut: Ctrl+Shift+B
'
    Sheets("3012-EST-1604").Range("F2:F15").Copy ActiveCell
    
End Sub

The code would need to be run while the sheet you select the cell on is the active sheet.
 
Last edited:
Upvote 0
That is certainly a better code than the one I just used. Thank you
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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