Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
time decision for open file in Excel
20 hours before current time is today,open file A
20 hours before current time is yesterday open file B. How can I use IF THEN function in EXCEL macro |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
time decision for open file in Excel
if 20 hours before current time is today,then open file A
if 20 hours before current time is yesterday,then open file B, use below formula can work if (NOW ()-TIME(19,59,59)<TODAY (),"Y","N") but how to change it as excel macro such that "Y" become "open file A" and "N" become "open file B". Can I use IF ...THEN...to do this? thx! |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
time decision for open file in Excel
Hi Thomas,
Am Mon, 2 May 2016 09:28:03 -0700 (PDT) schrieb : if 20 hours before current time is today,then open file A if 20 hours before current time is yesterday,then open file B, use below formula can work if (NOW ()-TIME(19,59,59)<TODAY (),"Y","N") try: Sub test() Dim myPath As String myPath = "C:\Users\myName\Documents\" If Int(Now() - TimeSerial(20, 0, 0)) = Date Then Workbooks.Open (myPath & "BookA.xlsx") Else Workbooks.Open (myPath & "BookB.xlsx") End If End Sub Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
time decision for open file in Excel
it works,thx
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Decision Matrix with multiple criteria and decision | Charts and Charting in Excel | |||
When i open excel file it takes time to open | Excel Discussion (Misc queries) | |||
Can Excel open a new application every time you open a file? | Setting up and Configuration of Excel | |||
How do I stop Excel from closing the open file each time I open a. | Setting up and Configuration of Excel | |||
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? | Setting up and Configuration of Excel |