ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   highlight with right click? (https://www.excelbanter.com/excel-programming/365805-highlight-right-click.html)

newbie

highlight with right click?
 
is there a simple way to color a cell with a right click (excel2003) ?

Norman Jones

highlight with right click?
 
Hi Newbie,

Perhaps a the response to a double click would meet your needs?

Try:

'=============
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Target.Interior.ColorIndex = 6 '<<== CHANGE
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Newbie" wrote in message
...
is there a simple way to color a cell with a right click (excel2003) ?




newbie

highlight with right click?
 
works like a dream. Thank you Norman.

"Norman Jones" wrote:

Hi Newbie,

Perhaps a the response to a double click would meet your needs?

Try:

'=============
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Target.Interior.ColorIndex = 6 '<<== CHANGE
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Newbie" wrote in message
...
is there a simple way to color a cell with a right click (excel2003) ?





Jim May

highlight with right click?
 
Norman:
Seeing this reminds me (daaa) - seems like a double-click caused excel to
think you wished to Edit a cell and thereby a Cancel = True line needed to be
entered -- before proceeding with the code. Can you clarify my confusion?

Thanks always for you great contribution to these NG's..

Jim May

"Norman Jones" wrote:

Hi Newbie,

Perhaps a the response to a double click would meet your needs?

Try:

'=============
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Target.Interior.ColorIndex = 6 '<<== CHANGE
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Newbie" wrote in message
...
is there a simple way to color a cell with a right click (excel2003) ?





Norman Jones

highlight with right click?
 
Hi Jim,

You are quite correct!

Amending, therefore the code:

'=============
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = 6
End Sub
'<<=============

Thanks for the remonder!

--
Regards,
Norman



"Jim May" wrote in message
...
Norman:
Seeing this reminds me (daaa) - seems like a double-click caused excel to
think you wished to Edit a cell and thereby a Cancel = True line needed to
be
entered -- before proceeding with the code. Can you clarify my confusion?

Thanks always for you great contribution to these NG's..

Jim May

"Norman Jones" wrote:

Hi Newbie,

Perhaps a the response to a double click would meet your needs?

Try:

'=============
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Target.Interior.ColorIndex = 6 '<<== CHANGE
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's
code
module (not a standard module and not the workbook's ThisWorkbook
module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"Newbie" wrote in message
...
is there a simple way to color a cell with a right click (excel2003) ?








All times are GMT +1. The time now is 08:37 AM.

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