IF macro VBA

Robert72

New Member
Joined
Nov 24, 2011
Messages
15
Hi,

i want to make a macro with a if formula that takes a value and placed it on the right row every row got's a specific date.

this is what i got so far:

If Sheets("Data").Range("A2") = "1" Then Sheets("Numpay").Range("F312").Copy
Sheets("3C").Select
Range("D12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

'other date:
If Sheets("Data").Range("A2") = 2 Then Sheets("Numpay").Range("F312").Copy
Sheets("3C").Select
Range("F12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

'the sheet data range A2 = the day
'in the sheet numpay are placed the values.
'sheets 3c is the sheet where it needs to be placed.

im working in excel 2003
greetz
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You can copy the data in Excel and paste it into a reply. Put borders around it first and don't post too much.
 
Upvote 0
Datum 1-11-2011 2-11-2011 3-11-2011 4-11-2011


American Express



This is what it looks like.
the value what is located at the sheet numpay needs to be placed under the specific date. in the row American Express.

the macro's i gave you are for the 1st and the 2nd.
 
Upvote 0
In collum A, B and C is put some information.
between D and F is putted a empty collum. i can delete that if that makes the macro better working
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,047
Members
449,206
Latest member
Healthydogs

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