Highlighting row where you are

Bethiepooh

Board Regular
Joined
Jun 7, 2002
Messages
51
I am interested in finding out how I can highlight the row I am currently working in? When I move rows, I want the highlighting to move to the appropriate row. How do you do this?
 
scrolling slightly further down that page, you get to a section that starts:

"If you require a highlighter that DOES NOT use conditional formating ie. it preserves all your colours and conditional formating AND also allows you to Copy, Paste and Undo/Redo then try this amended code"

...
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Ha thats true but....in the box where the code is suppose to be my screen shows a completely white box. There is no code to be found. Unless of course I have no clue what I am doing which is entirely possible.

Bill
 
Upvote 0
I get this:

Rich (BB code):
Option Explicit
'// Placed in the ThisWorkbook Object

Private Sub Workbook_Open()
    Application.OnKey "{RIGHT}", "HighlightRight"
    Application.OnKey "{LEFT}", "HighlightLeft"
    Application.OnKey "{UP}", "HighlightUp"
    Application.OnKey "{DOWN}", "HighlightDown"
    Application.OnKey "{DEL}", "DisableDelete"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.OnKey "{RIGHT}"
    Application.OnKey "{LEFT}"
    Application.OnKey "{UP}"
    Application.OnKey "{DOWN}"
    Application.OnKey "{DEL}"
End Sub

Option Explicit
'/////////////////////////////////
'// Original by NateO for aldo ///
'//     24th Jan 2003          ///
'//    Amended by IFM          ///
'//     28th Jan 2003          ///
'//    Amended by Aldo         ///
'//
'/////////////////////////////////

'// Placed in a Std Module

Dim strCol As String
Dim iCol As Integer
Dim dblRow As Double

Sub HighlightRight()
    HighLight 0, 1
End Sub

Sub HighlightLeft()
    HighLight 0, -1
End Sub

Sub HighlightUp()
    HighLight -1, 0, -1
End Sub

Sub HighlightDown()
    HighLight 1, 0, 1
End Sub

Sub HighLight(dblxRow As Double, iyCol As Integer, Optional dblZ As Double = 0)

'// Amended to highlight Activecell cross intersection
'// Amended as an Alternative to using Condtional Formats
'// As per Aldo thread;
'// http://216.92.17.166/board/viewtopic.php?topic=19239&forum=2&start=20&22

On Error GoTo NoGo
strCol = Mid(ActiveCell.Offset(dblxRow, iyCol).Address, _
        InStr(ActiveCell.Offset(dblxRow, iyCol).Address, "$") + 1, _
        InStr(2, ActiveCell.Offset(dblxRow, iyCol).Address, "$") - 2)
iCol = ActiveCell.Column
dblRow = ActiveCell.Row

'// If you don't want screen flicker
Application.ScreenUpdating = False
    
With Range(strCol & ":" & strCol & "," & dblRow + dblZ & ":" & dblRow + dblZ)
    .Select
    '// Need to reset here!
    Application.ScreenUpdating = True
    .Item(dblRow + dblxRow).Activate
End With

NoGo:
End Sub


Sub DisableDelete()
    Cells(ActiveCell.Row, ActiveCell.Column).Select
    Application.OnKey "{DEL}"
End Sub

Sub ReSet()
    Application.OnKey "{RIGHT}"
    Application.OnKey "{LEFT}"
    Application.OnKey "{UP}"
    Application.OnKey "{DOWN}"
End Sub
 
Upvote 0
easybpw said:
Ha thats true but....in the box where the code is suppose to be my screen shows a completely white box. There is no code to be found. Unless of course I have no clue what I am doing which is entirely possible.

Bill

Thanks Paddy

Hi Bill, yes the Blank box is due to your JIT being disabled
The pages has Java scripting on it.

Microsoft VN
JIT compiler for virtual machine enabled (requires restart)
Specifies whether Internet Explorer should create all Java
applets automatically by using its internal Micorsoft VM
compiler. For example, when you visit a Web site that uses
java applets, Internet Explorer automatically cretaes and runs
then for you, regardless of what operating system you use.
 
Upvote 0
I came across this old post, and Yogi's method sounds very interesting, but I can't get it to work. Every time I enter the formula as suggested, Excel seems to throw in extra quotes (""). The link here must be to a now defunct forum since I can't connect to it.

Can anyone provide me some insight?
 
Upvote 0
Oops! I didn't realize that there were several more pages in this thread.

The method that I am referring to in my comment just above is from the following:
Here's a non-marco approach I got from Yogi,

Highlight your range, and apply this formula under Conditional formatting

=CELL("row")=ROW()
Any help will be appreciated.
 
Upvote 0
Upvote 0
I'm not sure how many views this topic still gets nowadays, but this thread still shows up as a Top-10 for most views and I didn't see any reference in any of the previous posts to a dandy little add-in that Chip has released to the world. (Uses drawing objects instead of formatting to do the highlighting.) I know I've see cross-references to Chip's Rowliner elsewhere around the boards here. Just thought I'd add one here for any intrepid readers that make it this deep into the thread.
 
Upvote 0
On 2003-01-27 21:47, Ivan F Moala wrote:

Won't that clear the undo history? I'm sorry, but I'm exceptionally mistake prone. I live and die by my undo button. :biggrin:
It's too bad vba has to mess with the undo history, cuz I definitely prefer the single keystroke on the code you suggest.
On the other hand, losing the undo history may not be that significant to others and this is your beast now anwyay. I have gotten what I need out of it. She's all yours now.
Thanks again,
-aldo

You can keep the Undo functionality by changing the code to:
Sub DisableDelete()
Cells(ActiveCell.Row, ActiveCell.Column).Select
Application.OnKey "{DEL}"
SendKeys "{Del}"
End Sub

Also need to add:
Application.OnKey "{DEL}", "DisableDelete"
to the 1st line of the 'HighLight' sub,
- to re-enable the DEL key-trap when a cursor key is pressed

hope this helps....
Phil
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top