Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50238

Macro to Copy and Paste

$
0
0
Hello all.

This is my first post and I am fairly new to Excel so please bare with me.

I am trying to setup a Macro to copy a column from on sheet and paste it to another sheet based on the current date. Below is a current Macro that will do what I need, but it will paste the information to sheet 2 based on where the active cell is. How can I change this so that it will post to the column that has the current date? So on Sheet12 cell F2, i have the formula =today(). On the Historical Counts tab (Sheet14) Row 1 has the dates listed for the year. I need the macro to match F2 to the column on sheet14 and paste the information in that column. Can anyone help me out on this?

Code:

Sub CopyPasteData()
'
' CopyPasteData Macro
' Copies the On Hand Value and paste's the information on the Historical Counts Tab under the current date's column.
'
' Keyboard Shortcut: Ctrl+Shift+P
'
Sheet12.Range("F4:F101").Select
Selection.Copy
Sheets("Historical Counts - '13").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub


Viewing all articles
Browse latest Browse all 50238

Trending Articles