View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Indiana Jay
 
Posts: n/a
Default ONCE MORE!: Excel should feature a highlighted row/column cursor

Bob,

If I can presume upon you one more time, and you have been so good.
Sorry, but I am new to this area of visual basic event codes.

When I pasted in the original code, I saved it, exited, and the highlight
bar showed up. I did not name it, and I do not know how to turn the feature
off. So,

1) I'm not sure where I would put the "printing code". I am assuming I
append it to the same code I pasted? And do I activate it as well?

2) Can I just "De-Activate" the first code so that I can use the worksheet
normally without the highlighted bar when I want to? Otherwise, the highlight
is always on once I activated it. I do not always want to see it, but I am
unsure what the event code needs to De-Activate. When I select that option it
seems to give me some sort of template that is looking for a new subroutine?
--------------------------------------------------------------
Private Sub Worksheet_Deactivate()

End Sub
--------------------------------------------------------------

Thanks for your patience with me,

Jay

P.S. wouldn't this be a great option to turn on and off, like "gridlines" in
the Tools/Options "View" tab, and Window Options area



"Bob Phillips" wrote:

Yes that should be possible.

Change the highlighting code to this

'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
ThisWorkbook.Names.Add "'" & Me.Name & "'!_HiLite", True

Cells.FormatConditions.Delete
With Target
With .EntireRow
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With
With .EntireColumn
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


and add this printing code

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim hilite As Boolean
With ActiveSheet
hilite = False
On Error Resume Next
hilite = Evaluate(.Names(ActiveSheet.Name & _
"!__Hilite").RefersTo)
On Error GoTo 0
If hilite Then
.FormatConditions.Delete
End If
End With
End Sub


This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Indiana Jay" wrote in message
...
Dear Bob,

I tried this at work this morning and it was excellent! I really

appreciate
the tip. However, as I do not use macros much and am not familiar with

event
codes, when I went to print the highlight showed on the printout. ):

Is there a way to turn this off for printing purposes?

Thanks,

Jay






"Bob Phillips" wrote:

Well I hope you get your wish and sorry for trying to help.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Indiana Jay" wrote in message
...
I don't want some workaround macro, I want the feature built in.

"Bob Phillips" wrote:

This has been previously posted here http://tinyurl.com/bhhnr

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Indiana Jay" <Indiana wrote in

message
...
I would like to highlight a row or column with my cursor and have

it
scroll
as I move my cursor so that I can see what items are in the same
row/column
that my cursor is in.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to

the
suggestions with the most votes. To vote for this suggestion,

click
the "I
Agree" button in the message pane. If you do not see the button,
follow
this
link to open the suggestion in the Microsoft Web-based Newsreader

and
then
click "I Agree" in the message pane.




http://www.microsoft.com/office/comm...id=50c21b19-ae
38-4a89-a0a9-b17ffcf73a30&dg=microsoft.public.excel.misc