Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
Hi, could anybody please help -
if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
Here is one way to do that - including a way to turn the highlighting on or
off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
Thanks Tom,
When I turned on the Macro. I got "Compile error - Sub or Function not defined". The "Call HiliteCells" was highlighted for this Compiled error in the worksheet ? What shall I do ? karen "Tom Hutchins" wrote: Here is one way to do that - including a way to turn the highlighting on or off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
My guess is that you pasted the Public variable and subroutines into the
ThisWorkbook module. That won't work; you have to insert a VBA module. In the Visual Basic Editor, select Project Explorer from the View menu & make sure the Project Explorer window is displayed. You should see bold text that says VBAProject (ABC.xls), where ABC is the name of your workbook. Click the VBAProject with the name of your workbook, then select Module from the Insert menu. Paste the code I sent you, starting with "Public NotNow as Boolean", into the new code module. If you had pasted it into the ThisWorkbook module earlier, delete it there. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Hutch "KarenY" wrote: Thanks Tom, When I turned on the Macro. I got "Compile error - Sub or Function not defined". The "Call HiliteCells" was highlighted for this Compiled error in the worksheet ? What shall I do ? karen "Tom Hutchins" wrote: Here is one way to do that - including a way to turn the highlighting on or off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
I am familiar with recording and running macro but not with VBA-modules.
I followed your instruction. I pasted starting with "Public NotNow as Boolean" to the workbook - nothing happens when I run the "HiteOn". Then I realized I might have to paste the "Private Sub Worksheet_SelectionChange(ByVal Target As Range)...etc" to the worksheet, so I did the "paste" - again, nothing happens when I run the "HiteOn". I am sorry being "stupid". thanks Karen "Tom Hutchins" wrote: My guess is that you pasted the Public variable and subroutines into the ThisWorkbook module. That won't work; you have to insert a VBA module. In the Visual Basic Editor, select Project Explorer from the View menu & make sure the Project Explorer window is displayed. You should see bold text that says VBAProject (ABC.xls), where ABC is the name of your workbook. Click the VBAProject with the name of your workbook, then select Module from the Insert menu. Paste the code I sent you, starting with "Public NotNow as Boolean", into the new code module. If you had pasted it into the ThisWorkbook module earlier, delete it there. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Hutch "KarenY" wrote: Thanks Tom, When I turned on the Macro. I got "Compile error - Sub or Function not defined". The "Call HiliteCells" was highlighted for this Compiled error in the worksheet ? What shall I do ? karen "Tom Hutchins" wrote: Here is one way to do that - including a way to turn the highlighting on or off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
Definitiely, the Visual Basic Editor can be confusing at first. I have
created a small sample workbook with the crosshairs highlighting code set to work for Sheet1. Here is a link to it: http://www.freefilehosting.net/download/3dcfb To have the code work for Sheet2 (for example), copy & paste the same code in the Sheet1 code page to the Sheet2 code page. If you want the crosshairs highlighting to work on every sheet in the workbook, comment out the code on the individual sheets and uncomment the subroutine on the ThisWorkbook code page. Hope this helps, Hutch "KarenY" wrote: I am familiar with recording and running macro but not with VBA-modules. I followed your instruction. I pasted starting with "Public NotNow as Boolean" to the workbook - nothing happens when I run the "HiteOn". Then I realized I might have to paste the "Private Sub Worksheet_SelectionChange(ByVal Target As Range)...etc" to the worksheet, so I did the "paste" - again, nothing happens when I run the "HiteOn". I am sorry being "stupid". thanks Karen "Tom Hutchins" wrote: My guess is that you pasted the Public variable and subroutines into the ThisWorkbook module. That won't work; you have to insert a VBA module. In the Visual Basic Editor, select Project Explorer from the View menu & make sure the Project Explorer window is displayed. You should see bold text that says VBAProject (ABC.xls), where ABC is the name of your workbook. Click the VBAProject with the name of your workbook, then select Module from the Insert menu. Paste the code I sent you, starting with "Public NotNow as Boolean", into the new code module. If you had pasted it into the ThisWorkbook module earlier, delete it there. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Hutch "KarenY" wrote: Thanks Tom, When I turned on the Macro. I got "Compile error - Sub or Function not defined". The "Call HiliteCells" was highlighted for this Compiled error in the worksheet ? What shall I do ? karen "Tom Hutchins" wrote: Here is one way to do that - including a way to turn the highlighting on or off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Active cell with a "crosshair" indicator ?
I will definitely study your file and will make mine work. Thanks a million !
This is great help. Appreciate very much ! thanks Karen "Tom Hutchins" wrote: Definitiely, the Visual Basic Editor can be confusing at first. I have created a small sample workbook with the crosshairs highlighting code set to work for Sheet1. Here is a link to it: http://www.freefilehosting.net/download/3dcfb To have the code work for Sheet2 (for example), copy & paste the same code in the Sheet1 code page to the Sheet2 code page. If you want the crosshairs highlighting to work on every sheet in the workbook, comment out the code on the individual sheets and uncomment the subroutine on the ThisWorkbook code page. Hope this helps, Hutch "KarenY" wrote: I am familiar with recording and running macro but not with VBA-modules. I followed your instruction. I pasted starting with "Public NotNow as Boolean" to the workbook - nothing happens when I run the "HiteOn". Then I realized I might have to paste the "Private Sub Worksheet_SelectionChange(ByVal Target As Range)...etc" to the worksheet, so I did the "paste" - again, nothing happens when I run the "HiteOn". I am sorry being "stupid". thanks Karen "Tom Hutchins" wrote: My guess is that you pasted the Public variable and subroutines into the ThisWorkbook module. That won't work; you have to insert a VBA module. In the Visual Basic Editor, select Project Explorer from the View menu & make sure the Project Explorer window is displayed. You should see bold text that says VBAProject (ABC.xls), where ABC is the name of your workbook. Click the VBAProject with the name of your workbook, then select Module from the Insert menu. Paste the code I sent you, starting with "Public NotNow as Boolean", into the new code module. If you had pasted it into the ThisWorkbook module earlier, delete it there. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Hutch "KarenY" wrote: Thanks Tom, When I turned on the Macro. I got "Compile error - Sub or Function not defined". The "Call HiliteCells" was highlighted for this Compiled error in the worksheet ? What shall I do ? karen "Tom Hutchins" wrote: Here is one way to do that - including a way to turn the highlighting on or off. In the code module for each worksheet where you want this to happen, paste this code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call HiliteCells(Target) End Sub In a VBA module in the same workbook, paste this code: Public NotNow As Boolean Public Sub HiliteOn() NotNow = False End Sub Public Sub HiliteOff() NotNow = True Cells.Interior.ColorIndex = xlColorIndexNone End Sub Public Sub HiliteCells(Target As Range) If NotNow = False Then Cells.Interior.ColorIndex = xlColorIndexNone Target.EntireRow.Interior.ColorIndex = 36 Target.EntireColumn.Interior.ColorIndex = 36 End If End Sub (ColorIndex 36 is light yellow. Change to whatever you like). To start highlighting on that worksheet, run the HiliteOn macro. To stop it, run the HiliteOff macro. These could be assigned to toolbar buttons. Hope this helps, Hutch "KarenY" wrote: Hi, could anybody please help - if I put the cursor on an active cell on a spreadsheet, I want the corresponding row and column being highlighted (i.e. like a crosshair) - how do I do that ? appreciate your answer, thanks Karen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to make the active cell "pop out" | Excel Discussion (Misc queries) | |||
can I change the color of the "Comment Indicator" from red to ... | Excel Discussion (Misc queries) | |||
"red" Triangle in Comment Indicator- make bigger?? | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) | |||
"outline active cell differently than other cells" | Excel Discussion (Misc queries) |