ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   One click row highlighting (https://www.excelbanter.com/excel-programming/432426-one-click-row-highlighting.html)

Doug

One click row highlighting
 
I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


John

One click row highlighting
 
chip pearson has a very nice rowliner utility you can freely download.
http://www.cpearson.com/excel/RowLiner.htm

if thats not you are looking for you could on a very simple level, use the
worksheet selection_change event to select the required range.

Something like this may do want €“ Paste behind appropriate worksheet &
change selection range as required:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If

End Sub

Do remember though that you will have to use Tab key to step through
selected range to get to required cell(s).

--
jb


"Doug" wrote:

I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


Doug

One click row highlighting
 
Hey! This works great. I entered the range and all is well. I do have one
other question though. There is another private sub in the view code that is
also called Private Sub Worksheet_SelectionChange(ByVal Target As Range). It
said that there was an ambiguous error due to Worksheet_SelectionChange. I
tried changing the name so that they were not the same, but didn't work. Any
suggestions?
--



"john" wrote:

chip pearson has a very nice rowliner utility you can freely download.
http://www.cpearson.com/excel/RowLiner.htm

if thats not you are looking for you could on a very simple level, use the
worksheet selection_change event to select the required range.

Something like this may do want €“ Paste behind appropriate worksheet &
change selection range as required:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If

End Sub

Do remember though that you will have to use Tab key to step through
selected range to get to required cell(s).

--
jb


"Doug" wrote:

I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


Doug

One click row highlighting
 
I have to take back what I said. It didn't work right. When I double click on
the cell with a hyperlink, the line selection is overriding it. I would
rather not download the rowliner utility, but I may try it if I can't get
this to work?

I appreciate your help.
--



"john" wrote:

chip pearson has a very nice rowliner utility you can freely download.
http://www.cpearson.com/excel/RowLiner.htm

if thats not you are looking for you could on a very simple level, use the
worksheet selection_change event to select the required range.

Something like this may do want €“ Paste behind appropriate worksheet &
change selection range as required:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If

End Sub

Do remember though that you will have to use Tab key to step through
selected range to get to required cell(s).

--
jb


"Doug" wrote:

I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


John

One click row highlighting
 
You have answered your own question - procedure name already exits.

In that case just paste the code element in to the existing procedure i.e.
this bit:


If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If


--
jb


"Doug" wrote:

Hey! This works great. I entered the range and all is well. I do have one
other question though. There is another private sub in the view code that is
also called Private Sub Worksheet_SelectionChange(ByVal Target As Range). It
said that there was an ambiguous error due to Worksheet_SelectionChange. I
tried changing the name so that they were not the same, but didn't work. Any
suggestions?
--



"john" wrote:

chip pearson has a very nice rowliner utility you can freely download.
http://www.cpearson.com/excel/RowLiner.htm

if thats not you are looking for you could on a very simple level, use the
worksheet selection_change event to select the required range.

Something like this may do want €“ Paste behind appropriate worksheet &
change selection range as required:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If

End Sub

Do remember though that you will have to use Tab key to step through
selected range to get to required cell(s).

--
jb


"Doug" wrote:

I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


John

One click row highlighting
 
try adding these lines in the Worksheet_BeforeDoubleClick event

Application.EnableEvents = False

'your code

Application.EnableEvents = True
--
jb


"Doug" wrote:

I have to take back what I said. It didn't work right. When I double click on
the cell with a hyperlink, the line selection is overriding it. I would
rather not download the rowliner utility, but I may try it if I can't get
this to work?

I appreciate your help.
--



"john" wrote:

chip pearson has a very nice rowliner utility you can freely download.
http://www.cpearson.com/excel/RowLiner.htm

if thats not you are looking for you could on a very simple level, use the
worksheet selection_change event to select the required range.

Something like this may do want €“ Paste behind appropriate worksheet &
change selection range as required:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("A1:F11")) Is Nothing = False Then

Range("A" & Target.Row & ":" & "F" & Target.Row).Select

End If

End Sub

Do remember though that you will have to use Tab key to step through
selected range to get to required cell(s).

--
jb


"Doug" wrote:

I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight it
with a color or it will cover over the color conditional formatting I have,
but it would be great if it would show a box around it as though I selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--


Doug

One click row highlighting
 
Might you know why this is causing my undo to loose recent changes applied to
document? When I click a cell anywhere on the sheet, it cancels all
previously saved changes. If I need to undo a change, I won't be able to.
--



"Rick Rothstein" wrote:

Give this Worksheet Change event a try (set the address for your table of
data in the Const statement in place of my "D4:H17" example address)...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const TableRangeAddress As String = "D4:H17"
Dim TableRange As Range
On Error GoTo Whoops
Application.ScreenUpdating = False
Set TableRange = Range(TableRangeAddress)
TableRange.Borders.LineStyle = xlLineStyleNone
If Intersect(Target, TableRange) Is Nothing Then Exit Sub
Intersect(Target.EntireRow, TableRange).BorderAround Weight:=xlMedium
Whoops:
Application.ScreenUpdating = True
End Sub

--
Rick (MVP - Excel)


"Doug" wrote in message
...
I have a table. It would be very helpful if when I click on a cell in the
table that it highlight that particular row. I don't want it to highlight
it
with a color or it will cover over the color conditional formatting I
have,
but it would be great if it would show a box around it as though I
selected
the entire row. Can this be done for one click only, as I have macros for
individual cells that are set for double click?
--




Gord Dibben

One click row highlighting
 
That is side-effect of running VBA code.

Undo stack is eliminated.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 13:30:02 -0700, Doug
wrote:

Might you know why this is causing my undo to loose recent changes applied to
document? When I click a cell anywhere on the sheet, it cancels all
previously saved changes. If I need to undo a change, I won't be able to.



Doug

One click row highlighting
 
It won't let me copy and paste either. When I paste it erases the copy.
--
Thank you!


"Gord Dibben" wrote:

That is side-effect of running VBA code.

Undo stack is eliminated.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 13:30:02 -0700, Doug
wrote:

Might you know why this is causing my undo to loose recent changes applied to
document? When I click a cell anywhere on the sheet, it cancels all
previously saved changes. If I need to undo a change, I won't be able to.





All times are GMT +1. The time now is 05:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com