PDA

View Full Version : Solved: Looking for a KB



coliervile
02-12-2008, 12:14 AM
There use to be a KB that allowed you to left click a cell and the number one (1) would go in to the cell. Does anyone remeber this particular KB entry???

Best regards,

Charlie

mikerickson
02-12-2008, 12:50 AM
Put this in the code module for the sheet in question and 1 will be entered into a cell if it is Double-Clicked.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
Target.Value = 1
Cancel = True
End Sub

coliervile
02-12-2008, 05:11 AM
Thanks "mikerickson" how's your day? A you the same "mikerickson" that'son MrExcel? Thanks for you reply. If I wanted to set a range for instance A1:B20 and C10 to F10 were owuld this get placed?

Best regards,

Charlie

mdmackillop
02-12-2008, 06:43 AM
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
Dim Tgt As Range
Set Tgt = Union(Range("A1:B20"), Range("C10:F10"))
If Not Intersect(Target, Tgt) Is Nothing Then
Target.Value = 1
End If
Cancel = True
End Sub

coliervile
02-13-2008, 04:29 PM
Thanks mdmackillop for youe suggestion.

Best regards,

Charlie