samsilverman
Board Regular
- Joined
- Nov 9, 2009
- Messages
- 176
I am using Excel 2007
I have this code in my ThisWorkbook Module:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").Range("B2,B5,B8,B13").Font.ColorIndex = 2
End Sub
I have this code in each Worksheet Module I want to use it for:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("B2,B5,B8,B13").Font.ColorIndex = xlAutomatic
End Sub
Basically I am change the range to white font before printing so it doesn't show up. Then after the print, a click anywhere on the sheet makes the info in the range show up again.
The problem is I get an error box when I want to print preview. Is there a way around this?
The error box says: "Compile error: Ambiguous name detected: Workbook_BeforePrint"
Thanks
I have this code in my ThisWorkbook Module:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").Range("B2,B5,B8,B13").Font.ColorIndex = 2
End Sub
I have this code in each Worksheet Module I want to use it for:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("B2,B5,B8,B13").Font.ColorIndex = xlAutomatic
End Sub
Basically I am change the range to white font before printing so it doesn't show up. Then after the print, a click anywhere on the sheet makes the info in the range show up again.
The problem is I get an error box when I want to print preview. Is there a way around this?
The error box says: "Compile error: Ambiguous name detected: Workbook_BeforePrint"
Thanks