2 Macro questions

danielle

New Member
Joined
Mar 16, 2002
Messages
10
These questions both relate to an invoice set up in a worksheet.

1. After I have finished an 'invoice' I want to transfer some data onto another worksheet called Sales Journal. I need a macro that can copy 5 cells and paste them into the Sales Journal (one at a time, not all together). But problems occur because one of the cells from the invoice is made up of a calculation so when this copies over I just get the formula rather than the figure. Then the data has to be pasted below existing entries.

2. Once the above is done I want to clear the invoice so I can enter someone else's details. Now the macro to clear the details if fine, what I want to add to it though is an automatic incrementation of the invoice number. I have no clue how to do this.

Any idea's? Would be grateful for help [grin]
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Danielle--

1) If I understand your question, it sounds like your macro is pasting the formulas when you want it to paste values. I'm not sure if this was written or recorded, but if you look at the VB Editor you should see some code that looks like this:
selection.paste or activesheet.paste or something.pastespecial paste:=xlPasteAll
You want to change that to:
Selection.PasteSpecial paste:=xlValues so that you will on paste the values and not the formulas.

2)At the end of the macro that clears your invoice add Range ("the address of the cell with the invoice number").value=Range ("the address of the cell with the invoice number")+1. This will add one to the invoice number when you run the macro. If the number is in cell b2 then it looks like this:
Range("b2").value=Range("b2").value+1

I hope this helps you out.

Dave
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,996
Members
448,935
Latest member
ijat

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