Add copy a new row

tobyhutton1234

New Member
Joined
Dec 21, 2010
Messages
24
Hi there,

I'm having a little trouble and looking for some assistance.

Basically on the top of my worksheet I have a button 'Add Record'. Once clicked I want the spreadsheet to copy the contents of lets say B7:Q7 (including borders and cell colours.) from one worksheet (Sheet 2) to another (Sheet 1).

Once the button is clicked it should be placed at B8:Q8 (from Sheet 2 to Sheet 1) and so on.

Does anyone how to go about doing this?

Thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi there,

I'm having a little trouble and looking for some assistance.

Basically on the top of my worksheet I have a button 'Add Record'. Once clicked I want the spreadsheet to copy the contents of lets say B7:Q7 (including borders and cell colours.) from one worksheet (Sheet 2) to another (Sheet 1).

Once the button is clicked it should be placed at B8:Q8 (from Sheet 2 to Sheet 1) and so on.

Does anyone how to go about doing this?

Thanks

Not sure I follow you:

Code:
Sub buttoncopy()
Sheets("Sheet2").Range("B7:Q7").Copy Sheets("Sheet1").Range("B8")

End Sub
 
Upvote 0
Toby you need to add some code like this

Sub Button3_Click()
Sheets("sheet2").Select
Range("B7:q7").Copy
Sheets("Sheet1").Select
Range("B7").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.PasteSpecial xlPasteAll
End Sub
 
Upvote 0
Thanks Trevor,

Once you click the button the info from Sheet2 is pasted into Sheet1.

So B7:Q7 is copied into Range B:8 but once its clicked again its copied into B:8 again.

What I need it to do is move onto the next row each time the button is clicked.

Regards
 
Upvote 0
Can you upload the code you have as the code I uploaded would work.
 
Upvote 0
Code:
Sub Button3_Click()
    Sheets("DftRowSet").Select
        Range("B7:Q7").Copy
    Sheets("New Record").Select
        Range("B8").Select
        
Do Until ActiveCell.Value = ""
    ActiveCell.Offset(1, 0).Select
Loop
    ActiveCell.PasteSpecial xlPasteAll
                
End Sub
 
Upvote 0
Toby I have just copied the code as is shown and named a couple of sheets everything works fine. As I can't see the data you could try cahnging the .value to .text but I don't think that will make a difference.
 
Upvote 0
Trevor, that didnt seem to work.

tried endlessly last night but cant seem to get it loop to the next row once click again.

Hmmmmm

http://www25.brinkster.com/thutton/info.htm (Updated)


How about this modification?

Code:
Sub Button3()
Dim lr As Long

lr = Cells(Rows.Count, 2).End(xlUp).Row

    Sheets("DftRowSet").Select
        Range("B7:Q7").Copy
    Sheets("New Record").Select
        Range("B7:B" & lr + 1).Select
    ActiveSheet.Paste
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

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