ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Running code on workdays (https://www.excelbanter.com/excel-worksheet-functions/219116-running-code-workdays.html)

chrisnsmith

Running code on workdays
 
What do I need to do to get this to execute only on workdays?

Sheets("Cus Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents
'
Sheets("House Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents


Bob Phillips[_3_]

Running code on workdays
 
If Weekday(Date, vbMonday) < 6 Then

With Worksheets("Cus Futures")

.Range(" H9:I50").Copy .Range("D9:E50")
.Range("F9:I50").ClearContents
End With

With Worksheets("House Futures")

.Range(" H9:I50").Copy .Range("D9:E50")
.Range("F9:I50").ClearContents
End With
End If


--
__________________________________
HTH

Bob

"chrisnsmith" wrote in message
...
What do I need to do to get this to execute only on workdays?

Sheets("Cus Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents
'
Sheets("House Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents




Chip Pearson

Running code on workdays
 
If Weekday(Now, vbSaturday) = 3 Then
' your code here
End If

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 4 Feb 2009 09:53:01 -0800, chrisnsmith
wrote:

What do I need to do to get this to execute only on workdays?

Sheets("Cus Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents
'
Sheets("House Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents



All times are GMT +1. The time now is 04:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com