Consulting

Results 1 to 3 of 3

Thread: Solved: BeforeDoubleClick setting column and row?

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

    Solved: BeforeDoubleClick setting column and row?

    In the following macro the columns are set, but my question is can you set the columns to start on a specified row (e.g. column 1 row 4)??? What I want is for the "doubleclick" to star in Columns 1,2,12 and 13 on row 4 and continue down from there.

    Regards,
    Charlie

    [VBA] Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Select Case Target.Column
    Case 1, 2
    If Target = "" Then
    Target = "a"
    Target.Font.Name = "marlett"
    Else: Target = ""
    End If
    Cancel = True
    Case 12:
    If Target = "" Then
    Target = "Williamson"
    Else: Target = ""
    End If
    Cancel = True
    Case 13:
    If Target = "" Then
    Target = "Michaelson"
    Else: Target = ""
    End If
    Cancel = True
    Case Else: Exit Sub
    End Select

    End Sub[/VBA]

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Just exit the sub if the row number is less than 4
    [vba]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Row < 4 Then Exit Sub
    Select Case Target.Column
    'etc.
    [/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'

  3. #3
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    "md" you never cease to amaze me....it works great. Thanks for you kelp item resolved.

    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
  •