![]() |
cross hair
i am a teacher and use excell for grades . Names on top assignments on the
right side. i am trying to make cross hairs what ever cell i click into i will see a color line vertical and horsonal to help me make sure the right grades are entered. i have office 2007 pro. -- Mr. Coffee |
cross hair
Does this SelectionChange event code do what you want...
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = 0 Union(Target.EntireColumn, Target.EntireRow).Interior.ColorIndex = 40 End Sub Change the ColorIndex value to suit your own personal tastes. -- Rick (MVP - Excel) "johnpotter94501" wrote in message ... i am a teacher and use excell for grades . Names on top assignments on the right side. i am trying to make cross hairs what ever cell i click into i will see a color line vertical and horsonal to help me make sure the right grades are entered. i have office 2007 pro. -- Mr. Coffee |
cross hair
It occurs to me that you may not know how to implement the code I gave you
earlier. Right click the tab at the bottom of the worksheet where you want to create the cross hair indicator, select View Code from the popup menu that appears and then copy/paste the code I gave you earlier into the code window that appeared. -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... Does this SelectionChange event code do what you want... Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = 0 Union(Target.EntireColumn, Target.EntireRow).Interior.ColorIndex = 40 End Sub Change the ColorIndex value to suit your own personal tastes. -- Rick (MVP - Excel) "johnpotter94501" wrote in message ... i am a teacher and use excell for grades . Names on top assignments on the right side. i am trying to make cross hairs what ever cell i click into i will see a color line vertical and horsonal to help me make sure the right grades are entered. i have office 2007 pro. -- Mr. Coffee |
cross hair
Rick, Thanks for sharing your crosshair sub. Is there a way in which we can
control that worksheet sub's activation/deactivation via say, another sub assigned to a button? This is meant to enable "normal" mode (ie with crosshair sub deactivated) so that we can work on the sheet as per normal, with undo available, and switch-over to activate the crosshair sub whenever required. Thanks |
cross hair
Here is one way to do that. Replace the code I posted earlier with the all
the code I have marked below instead. To activate/deactivate the crosshair mode, just double click any cell on the worksheet... if the crosshair is visible, it will be turned off... if the crosshair is not visible, it will be turned on. '*************** START OF CODE *************** Dim CrosshairModeOn As Boolean Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) Cancel = True CrosshairModeOn = Not CrosshairModeOn If CrosshairModeOn Then Union(Target.EntireColumn, Target.EntireRow).Interior.ColorIndex = 15 Else Cells.Interior.ColorIndex = 0 End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If CrosshairModeOn Then Cells.Interior.ColorIndex = 0 Union(Target.EntireColumn, Target.EntireRow).Interior.ColorIndex = 15 End If End Sub '*************** END OF CODE *************** -- Rick (MVP - Excel) "Max" wrote in message ... Rick, Thanks for sharing your crosshair sub. Is there a way in which we can control that worksheet sub's activation/deactivation via say, another sub assigned to a button? This is meant to enable "normal" mode (ie with crosshair sub deactivated) so that we can work on the sheet as per normal, with undo available, and switch-over to activate the crosshair sub whenever required. Thanks |
cross hair
Rick the code worked fine except when i close the file it won't work again .
also can i defult this to the workbook john -- Mr. Coffee "johnpotter94501" wrote: i am a teacher and use excell for grades . Names on top assignments on the right side. i am trying to make cross hairs what ever cell i click into i will see a color line vertical and horsonal to help me make sure the right grades are entered. i have office 2007 pro. -- Mr. Coffee |
cross hair
Which code are we talking about, the SelectionChange event code (which
should work when you open the workbook again) or the macro version (which requires you to start it each time you open the workbook)? As for defaulting the code to the workbook "john"... if you put it in that workbook, it should be available whenever you open that workbook. Perhaps if you can provide more detail describing what you want to happen, then we won't have to try and guess at what you are ultimately looking for. -- Rick (MVP - Excel) "johnpotter94501" wrote in message ... Rick the code worked fine except when i close the file it won't work again . also can i defult this to the workbook john -- Mr. Coffee "johnpotter94501" wrote: i am a teacher and use excell for grades . Names on top assignments on the right side. i am trying to make cross hairs what ever cell i click into i will see a color line vertical and horsonal to help me make sure the right grades are entered. i have office 2007 pro. -- Mr. Coffee |
cross hair
Superb! Many thanks for your solution, Rick.
|
All times are GMT +1. The time now is 09:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com