Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
I want to effect all sheets...ThisWorkbook?
What i'd like to do for this VBAProject is after a certain date, say
12/31/2008, all the data in the cells, the backgrounds, borders, basically everything will be turned white. I'm guessing this code would go in the ThisWorkbook object and be a simple if..then code. And yes, this is to prank a co-worker. Happy Holiday all! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
I want to effect all sheets...ThisWorkbook?
How about just hidding the sheet like this. Put into the thisworkbook mode
Private Sub Workbook_Open() If Date "12/31/2008" Then Worksheets("Sheet1").Visible = xlSheetHidden End If End Sub "JSnow" wrote: What i'd like to do for this VBAProject is after a certain date, say 12/31/2008, all the data in the cells, the backgrounds, borders, basically everything will be turned white. I'm guessing this code would go in the ThisWorkbook object and be a simple if..then code. And yes, this is to prank a co-worker. Happy Holiday all! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
I want to effect all sheets...ThisWorkbook?
Copy the following code to the thisworkbook module. To make this code
work, you would need to change the security feature of macro, toolsmacrosecurity medium/low. If you choose medium, then the following code will work if the user enables the macro. Different system will have its own macro security, so the code below wont work if accessed with a different system with security set to high. '_________________________________________________ __________________________ 'Copy the code below to a thisworkbook module Private Sub Workbook_Open() 'compare date date If DateValue(Now()) = DateValue(DateSerial(2008, 12, 31)) Then With ThisWorkbook For i = 1 To .Sheets.Count .Sheets(i).Activate With ActiveSheet.Cells .Font.ColorIndex = 2 .Borders.ColorIndex = 2 .Interior.ColorIndex = 2 End With Next i End With End If End Sub '_________________________________________________ __________________________ ' You may not use the above code with a malicious intent. I hope this helps. Selva V Pasupathy For more on Excel, VBA, and other resources Please visit: http://socko.wordpress.com |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
I want to effect all sheets...ThisWorkbook?
Thanks, Socko. I replaced the color idea w/ Mike's suggestion to just hide
everything. I used ".EntireColumn.Hidden = True" and it works beautifully. Thanks again. "Socko" wrote: Copy the following code to the thisworkbook module. To make this code work, you would need to change the security feature of macro, toolsmacrosecurity medium/low. If you choose medium, then the following code will work if the user enables the macro. Different system will have its own macro security, so the code below wont work if accessed with a different system with security set to high. '_________________________________________________ __________________________ 'Copy the code below to a thisworkbook module Private Sub Workbook_Open() 'compare date date If DateValue(Now()) = DateValue(DateSerial(2008, 12, 31)) Then With ThisWorkbook For i = 1 To .Sheets.Count .Sheets(i).Activate With ActiveSheet.Cells .Font.ColorIndex = 2 .Borders.ColorIndex = 2 .Interior.ColorIndex = 2 End With Next i End With End If End Sub '_________________________________________________ __________________________ ' You may not use the above code with a malicious intent. I hope this helps. Selva V Pasupathy For more on Excel, VBA, and other resources Please visit: http://socko.wordpress.com |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
I want to effect all sheets...ThisWorkbook?
Don't Let The stress last to long. It's Christmas ,Not trick or treat
Stew "JSnow" wrote: Thanks, Socko. I replaced the color idea w/ Mike's suggestion to just hide everything. I used ".EntireColumn.Hidden = True" and it works beautifully. Thanks again. "Socko" wrote: Copy the following code to the thisworkbook module. To make this code work, you would need to change the security feature of macro, toolsmacrosecurity medium/low. If you choose medium, then the following code will work if the user enables the macro. Different system will have its own macro security, so the code below wont work if accessed with a different system with security set to high. '_________________________________________________ __________________________ 'Copy the code below to a thisworkbook module Private Sub Workbook_Open() 'compare date date If DateValue(Now()) = DateValue(DateSerial(2008, 12, 31)) Then With ThisWorkbook For i = 1 To .Sheets.Count .Sheets(i).Activate With ActiveSheet.Cells .Font.ColorIndex = 2 .Borders.ColorIndex = 2 .Interior.ColorIndex = 2 End With Next i End With End If End Sub '_________________________________________________ __________________________ ' You may not use the above code with a malicious intent. I hope this helps. Selva V Pasupathy For more on Excel, VBA, and other resources Please visit: http://socko.wordpress.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compile error in hidden module: ThisWorkbook | New Users to Excel | |||
Workbook_Open in ThisWorkbook.module | Excel Discussion (Misc queries) | |||
ThisWorkbook.Print question | Excel Discussion (Misc queries) | |||
Problem with ThisWorkbook.RefreshAll | Excel Discussion (Misc queries) | |||
ThisWorkbook of personal.xls | Excel Discussion (Misc queries) |