+ Reply to Thread
Results 1 to 7 of 7

Target.offset

  1. #1
    trussman
    Guest

    Target.offset

    Help please.. This works but, I want to be able to double click
    anywhere in the same row and activate the same target(in column 2). I
    currently have 223 columns.
    Is this possible?



    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
    As Boolean)
    Cancel = True

    Worksheets(Target.Offset(0, -15).Value).Activate

    End Sub



    Thanks in advance,

    Marc


  2. #2
    JulieD
    Guest

    Re: Target.offset

    Hi

    if you always just want to active the cell in column B of whatever row
    you're in try

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
    Boolean)
    Target.Offset(0, 2 - Target.Column()).Activate
    End Sub


    Cheers
    JulieD

    "trussman" <[email protected]> wrote in message
    news:[email protected]...
    > Help please.. This works but, I want to be able to double click
    > anywhere in the same row and activate the same target(in column 2). I
    > currently have 223 columns.
    > Is this possible?
    >
    >
    >
    > Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
    > As Boolean)
    > Cancel = True
    >
    > Worksheets(Target.Offset(0, -15).Value).Activate
    >
    > End Sub
    >
    >
    >
    > Thanks in advance,
    >
    > Marc
    >




  3. #3
    trussman
    Guest

    Re: Target.offset

    Thank you for the reply,

    Well actually I need it to activate the sheet of the employee name in
    column 2 by double clicking in any cell in the row of that employee.

    Thanks, Marc


  4. #4
    JulieD
    Guest

    Re: Target.offset

    Hi Marc

    in that case just use

    Worksheets(Target.Offset(0, 2 - Target.Column()).Value).Activate

    Cheers
    JulieD

    "trussman" <[email protected]> wrote in message
    news:[email protected]...
    > Thank you for the reply,
    >
    > Well actually I need it to activate the sheet of the employee name in
    > column 2 by double clicking in any cell in the row of that employee.
    >
    > Thanks, Marc
    >




  5. #5
    trussman
    Guest

    Re: Target.offset

    Thank you JulieD!

    Marc


  6. #6
    JulieD
    Guest

    Re: Target.offset

    you're welcome

    "trussman" <[email protected]> wrote in message
    news:[email protected]...
    > Thank you JulieD!
    >
    > Marc
    >




  7. #7
    Dave D-C
    Guest

    Re: Target.offset

    trussman wrote:
    >Help please.. This works but, I want to be able to double click
    >anywhere in the same row and activate the same target(in column 2). I
    >currently have 223 columns.
    >Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
    >As Boolean)
    >Cancel = True
    >Worksheets(Target.Offset(0, -15).Value).Activate
    >End Sub


    How about
    Cells(Target.Row, 2).Select
    (If you have a single-cell selection, I think 'select'
    is preferable to 'activate'.)

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1