Need some help with VBA-Macro

renman27

New Member
Joined
Dec 19, 2018
Messages
16
Hello,

In the past I created a Recording Macro that will clear the screen when I use the clear button.
I am making a new copy with a different version. I have a message box as well... But I am trying to copy and paste and change it to work on larger file...
Is there an easier way or to do this.?

Basic thing is to have a easy option to click a button and copy and paste from the back up to each schedule...clear format and words.

Here is what is on another file..

Sub Top()
'
' Top Macro
'
If MsgBox("are you sure?", vbYesNo) = vbYes Then
Range("D4").Select
Sheets("backup").Select
Range("D4:N16").Select

Selection.Copy
Sheets("IPT MEETING SCHEDULE").Select
ActiveSheet.Paste
End If
End Sub
Sub Bottom()
'
' Bottom Macro
'
If MsgBox("are you sure?", vbYesNo) = vbYes Then
Range("B21").Select
Sheets("backup").Select
Range("B21:M33").Select

Selection.Copy
Sheets("IPT MEETING SCHEDULE").Select
ActiveSheet.Paste
End If
End Sub
 

Attachments

  • Excel.JPG
    Excel.JPG
    137.2 KB · Views: 9
  • old excel.JPG
    old excel.JPG
    165.5 KB · Views: 8

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe this
VBA Code:
Sub Bottom()
If MsgBox("are you sure?", vbYesNo) = vbYes Then
    Sheets("backup").Range("B21:M33").Copy Sheets("IPT MEETING SCHEDULE").Range("A1")
End If
End Sub
 
Upvote 0
Maybe this
VBA Code:
Sub Bottom()
If MsgBox("are you sure?", vbYesNo) = vbYes Then
    Sheets("backup").Range("B21:M33").Copy Sheets("IPT MEETING SCHEDULE").Range("A1")
End If
End Sub
Not sure..Because I can change the range... E11:AM39 like the pic....but I cant remember how I did the Record macro and then had the copy and paste...
 

Attachments

  • excel 1.JPG
    excel 1.JPG
    182.6 KB · Views: 7
Upvote 0
Update....

I can get the Macro to work....but for some reason I cant assign again to a button? I am also getting an error after I get the warning prompt?


Sub Top()
'
' Week1Macro
'
If MsgBox("are you sure?", vbYesNo) = vbYes Then
Range("E11").Select
Sheets("backup").Select
Range("E11:AM38").Select

Selection.Copy
Sheets("Week1").Select
ActiveSheet.Paste
End If
End Sub

Sub Bottom()
'
' Week2Macro
'
If MsgBox("are you sure?", vbYesNo) = vbYes Then
Range("E11").Select
Sheets("backup").Select
Range("E11:AM38").Select

Selection.Copy
Sheets("Week2").Select
ActiveSheet.Paste
End If
End Sub
 

Attachments

  • warning.JPG
    warning.JPG
    29 KB · Views: 9
Upvote 0

Forum statistics

Threads
1,223,934
Messages
6,175,487
Members
452,648
Latest member
Candace H

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