Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 293
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error in hidden module: ThisWorkbook Slibert New Users to Excel 2 May 19th 08 12:22 AM
Workbook_Open in ThisWorkbook.module Bob Barnes Excel Discussion (Misc queries) 1 February 12th 08 07:52 PM
ThisWorkbook.Print question Dave Excel Discussion (Misc queries) 1 November 19th 07 05:55 PM
Problem with ThisWorkbook.RefreshAll Vick Excel Discussion (Misc queries) 3 September 7th 07 12:26 AM
ThisWorkbook of personal.xls Jack Sons Excel Discussion (Misc queries) 4 August 29th 07 04:28 PM


All times are GMT +1. The time now is 02:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"