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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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