Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting the col num inside a range (2000)

    I have a range call it MyRange.
    It may be located somewhere like "N12: T300"

    I need the Column number (within MyRange) of the activecell when the activecell
    is located inside MyRange

    Something like ---
    Dim x as integer
    x = Range("MyRange").Selection.Column


    if the activecell is P25
    x=3
    in the above example for MyRange

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Getting the col num inside a range (2000)

    Something like:
    <pre>If Not Intersect(Activecell, Range("MyRange")) Is Nothing Then
    x = ActiveCell.Column - Range("MyRange").Column + 1
    End If
    </pre>


    HTH
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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