Copy code to new sheet using VB

BShady

New Member
Joined
Apr 26, 2010
Messages
2
When I open a "master" price sheet, the following code opens an "expiration" message box. The code below it copies a subset of data into a new sheet when I click on a buttton. I'd like to get the expiration message added to that new sheet also. Any ideas?

Code:
Sub Auto_Open()
    Dim exdate As Date
       
    exdate = "12/31/10"
    If Date > exdate Then
    MsgBox ("Spreadsheet has Expired")
    ActiveWorkbook.Close
    End If
    MsgBox ("This Workbook is Valid Until " & exdate & " - - - You have " & exdate - Date & " Days left")

I'd like to get the above copied into the sheet created by the following code:

Code:
Sub New_Transfer_Price_Sheet()
'
' New_Transfer_Price_Sheet Macro
' Macro recorded 4/14/2010 by rshadis
'
'
    Dim NewWrkBook As Excel.Workbook
    
    Set NewWrkBook = Application.Workbooks.Add
    Windows("2010 Unprotected Parts Pricing MASTER.xls").Activate
    Range("A1:D65536,I1:I65536").Select
    Selection.Copy
    NewWrkBook.Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Cells.Select
    Cells.EntireColumn.AutoFit
End Sub


Any help is so very much appreciated!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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