Macro that copies and pastes according to range

Brand_New2VBA

New Member
Joined
May 24, 2011
Messages
1
Hi Guys:),

I'm brand new to VBA and I need some help completeing a code I have.

I need certain information to be copied from one sheet and pasted in sheet 4 according to month. So--for instance-- on sheet one i want the information copied (persons name and date of birth) to be pasted in sheet four under the specific month of birth. sheet two has several columns of merged cells that are names by month. I want the macro to tell excel to copy the information from sheet one and paste it under the merged range according to the person's month of birth.

is this possible:eeek: ? so far this is the code I have (i am using excel 2007):

Private Sub CommandButton1_Click()
Dim wksSource As Worksheet
Dim wksDestination As Worksheet
Dim vntCloneRange As Variant
Dim nextrow As Long

Set wksSource = Sheet1
Set wksDestination = Sheet4

If Range("B4,e4") = "published" Then
vntCloneRange = wksSource.Range("c5:c10")
nextrow = Sheet4.Range("May").AutoFill(Rows.Count, "C").End(xlUp).Row + 3
wksDestination.Range("C" & nextrow).Resize(UBound(vntCloneRange), 1) = vntCloneRange
Erase vntCloneRange
Range("b4:e11").Delete Shift:=xlUp
End sub
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,224,557
Messages
6,179,508
Members
452,918
Latest member
Davion615

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