Consulting

Results 1 to 5 of 5

Thread: Solved: Looking for a KB

  1. #1
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location

    Solved: Looking for a KB

    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

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    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

  3. #3
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    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

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [vba]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
    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    Thanks mdmackillop for youe suggestion.

    Best regards,

    Charlie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •