im Stuck

B4L4KS

Board Regular
Joined
Mar 7, 2011
Messages
69
hi

i have been asked to create a spreadsheet for a pizza company that involves being able to add a new customer via a macro, this will include a name and address, this will have to be assigned to a macro and will add a new line for a new customer to be added below.

Code:
Sub adddetails()
'
' adddetails Macro
'

'
    Range("Q12:R12").Select
    Selection.Copy
    Sheets("Customer Details").Select
    Range("G22:H22").Select
    ActiveSheet.Paste
    Sheets("Home Page").Select
    Range("Q13:R13").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Customer Details").Select
    Range("I22:J22").Select
    ActiveSheet.Paste
    Sheets("Home Page").Select
    Range("Q17:R17").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Customer Details").Select
    Range("M22:N22").Select
    ActiveSheet.Paste
    Sheets("Home Page").Select
    Range("Q18:R18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Customer Details").Select
    Range("O22:P22").Select
    ActiveSheet.Paste
    Sheets("Home Page").Select
    Range("Q19:R19").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Customer Details").Select
    Range("Q22:R22").Select
    ActiveSheet.Paste
    Sheets("Home Page").Select
    Range("Q20:R20").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Customer Details").Select
    Range("S22:T22").Select
    ActiveSheet.Paste
End Sub

so basically my question is, how can i cut information from one worksheet and place it into another using the next available row.

thanks in advance,



kristian
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
You can use n number of ways to determine the last used range in a sheet. like ex:
activesheet.usedrange.rows.count

I sometimes identify the next empty cell in a sheet using the below code:

range("a65536").end(xlup).offset(1,0).select

and then u paste whatever copied

selection.pastespecial paste:=xlvalues ......

This will select the next empty cell in a sheet. If you happen to use very large amount of data then make sure you give a big number there.

Let me know if this helps.:)

Regards
Arsalan

"Very small life and lot to learn"
 
Upvote 0
hi

thanks for the help but i am not so good at using macros,

would it be possible to paste a quick code

thanks again
kristian
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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