Macro button to copy data from one sheet to another

Emb21

Board Regular
Joined
Jul 8, 2004
Messages
152
Hello,

Is there a macro that can copy info from another tab and place it in the current tab.

Example:

I'm in Sheet 2 and want to copy data from Sheet 1. and the cells I want to copy is A8 thru J207 from sheet 1 to sheet 2's A8 thru J207.

Also, I'm creating a button and would like to add prompt before the macro is executed that reads "Are you sure want to copy the data from the previous day? All current data will be lost." Yes No and if they press yes it would execute macro

Any help would be appreciated. Thank you. :)

Eric
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Add the Command buttom from the Controls Toolbox. Right Click the button and choose View Code. You will be taken to Commandbutton Click procedure. Paste this code in the procedure:

Dim Response
Response = MsgBox("Are you sure you want to copy?", vbOKCancel)
If Response = vbCancel Then Exit Sub
Sheets(2).[a8:j207].Copy Sheets(1).[a8]
 
Upvote 0
Without trying to be picky, I would change:
vbOKCancel
with
vbYesNo

It is easier for users to understand when you ask a question.
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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