Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Msg Box
Hi,
I need to create a very simple sub: In cell A1 I input a date; If A1 is different from today, then an Msg Box says "Date is different of today. Do you wish to continue? Buttons Ok and Cancel Can anybody help? Best regards, Alexandre |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Msg Box
Hi Alexandre,
Try something like: '============ Option Explicit Public Sub Tester001() Dim WB As Workbook Dim SH As Worksheet Dim Rng As Range Set WB = Workbooks("Test.xls") '<<==== CHANGE Set SH = WB.Sheets("Sheet1") '<<==== CHANGE Set Rng = SH.Range("A1") If Rng.Value < Date Then MsgBox Prompt:="Date is different to today. " _ & "Do you wish to continue?", _ Buttons:=vbOKCancel, _ Title:="Date Check" End If End Sub '<<============ --- Regards, Norman "Alexandre Chauar" wrote in message ... Hi, I need to create a very simple sub: In cell A1 I input a date; If A1 is different from today, then an Msg Box says "Date is different of today. Do you wish to continue? Buttons Ok and Cancel Can anybody help? Best regards, Alexandre |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Msg Box
Hi Norman,
It worked! Thanks a lot for your help. Alexandre "Norman Jones" escreveu na mensagem ... Hi Alexandre, Try something like: '============ Option Explicit Public Sub Tester001() Dim WB As Workbook Dim SH As Worksheet Dim Rng As Range Set WB = Workbooks("Test.xls") '<<==== CHANGE Set SH = WB.Sheets("Sheet1") '<<==== CHANGE Set Rng = SH.Range("A1") If Rng.Value < Date Then MsgBox Prompt:="Date is different to today. " _ & "Do you wish to continue?", _ Buttons:=vbOKCancel, _ Title:="Date Check" End If End Sub '<<============ --- Regards, Norman "Alexandre Chauar" wrote in message ... Hi, I need to create a very simple sub: In cell A1 I input a date; If A1 is different from today, then an Msg Box says "Date is different of today. Do you wish to continue? Buttons Ok and Cancel Can anybody help? Best regards, Alexandre |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|