Copy cells into another worksheet and generate ID

lynnster

New Member
Joined
Mar 22, 2009
Messages
2
I have difficulties coding the following: :(

How do i go about copying certain cells from worksheet1 to worksheet2 and then clear the content in worksheet1 and generate a new order ID in worksheet1?

2zjhu9x.gif
 

Excel Facts

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

You need to work out:

: how to copy data from one sheet to another,

: how to locate the next blank row in a sheet

: how to update the order number cell

All the answers are on this forum and elsewhere via google.

I'll give you a start, to update the order number (if the order number is in cell B1 in sheet 1, the code would be -

sheets("sheet1").range("b1").value = sheets("sheet1").range("b1").value + 1

I could give you the whole thing, but trust me on this one, you'd be bette off learning it, it really isn't that difficult, and once you do you'll find that you can do far more than you originally thought.


Matt
 
Upvote 0
To select the next blank row, you have to find the last row.

Assuming you have continuous data in column A
<code>
range("a1").end(xldown).select
<code>

will select the last cell in column A with data in it.

Then

<code>
selection.offset(1,0).select
<code>

will move it down one

or skip the step by using

<code>
range("a1").end(xldown).offset(1,0).select
<code>
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,291
Members
448,564
Latest member
ED38

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