Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Given one column: Insert date and a specific color by clicking a cell
in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about double click?
put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help...not working yet...getting syntax error on first
line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK...got the syntax issue resolved...now...how would i be able to do
two columns on the same sheet? i.e, column c in yellow...column e in red? Thanks again Ken Ken wrote: Thanks for the help...not working yet...getting syntax error on first line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Intersect(Target, Columns("C")) Is Nothing Then
becomes If Intersect(Target, me.range("C:D")) Is Nothing Then (I like to qualify my ranges.) Ken wrote: OK...got the syntax issue resolved...now...how would i be able to do two columns on the same sheet? i.e, column c in yellow...column e in red? Thanks again Ken Ken wrote: Thanks for the help...not working yet...getting syntax error on first line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
oops.
Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) With Target If .Cells.Count 1 Then Exit Sub If Intersect(.Cells, Me.Range("C:C,E:E")) Is Nothing Then Exit Sub If .Column = 3 Then .Interior.ColorIndex = 6 Else .Interior.ColorIndex = 3 'change to what you want End If .Value = Date End With End Sub I didn't read the whole followup. Ken wrote: OK...got the syntax issue resolved...now...how would i be able to do two columns on the same sheet? i.e, column c in yellow...column e in red? Thanks again Ken Ken wrote: Thanks for the help...not working yet...getting syntax error on first line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Great job Dave...works like a charm. Thanks to everyone who contributed
Dave Peterson wrote: oops. Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) With Target If .Cells.Count 1 Then Exit Sub If Intersect(.Cells, Me.Range("C:C,E:E")) Is Nothing Then Exit Sub If .Column = 3 Then .Interior.ColorIndex = 6 Else .Interior.ColorIndex = 3 'change to what you want End If .Value = Date End With End Sub I didn't read the whole followup. Ken wrote: OK...got the syntax issue resolved...now...how would i be able to do two columns on the same sheet? i.e, column c in yellow...column e in red? Thanks again Ken Ken wrote: Thanks for the help...not working yet...getting syntax error on first line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You probably got hit by line wrap.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) should be all on one line. Gord Dibben MS Excel MVP On 2 Sep 2006 12:13:01 -0700, "Ken" wrote: Thanks for the help...not working yet...getting syntax error on first line of code...is something missing? Ken Gary''s Student wrote: How about double click? put this in worksheet code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub End If Target.Value = Date Target.Interior.ColorIndex = 6 End Sub double click any cell in column C and get the date and a yellow background. -- Gary's Student "Ken" wrote: Given one column: Insert date and a specific color by clicking a cell in that column with mouse: either right or left...Clicking on any cell in the column should produce the same results. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Edit cell by using mouse - right click | Excel Discussion (Misc queries) | |||
How to increment a cell by 1 on mouse click or move to another cel | Excel Discussion (Misc queries) | |||
Opening a URL in a cell without a mouse click | Excel Discussion (Misc queries) | |||
Add cell value with mouse click | Excel Discussion (Misc queries) | |||
get value of a cell with a mouse click | Excel Programming |