Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Clicked cell is in 'this range' ... (WinNT4, XL97)

    Hopefully a very quick question! How would one phrase this question in VBA?

    "If target.addresslocal (ie clicked cell) is a cell within the range C3-C50, then ...
    do this to the cell two down and two to the left (would this be offset?)
    etc

    Many thanks in advance!
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Clicked cell is in 'this range' ... (WinNT4, XL97)

    ' check if target is only one cell
    If Target.Count = 1 Then
    ' check if it is within C3:C50
    If Not Intersect(Target, Range("C3:C50)) Is Nothing Then
    ' Do something
    Target.Offset(2, -2) = ...
    End If
    End If

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Clicked cell is in 'this range' ... (WinNT4, XL97)

    Thanks, Hans - perfick, as usual!

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17> I think maybe I should just start my posts by saying "Hans, how do I ..." in future; I can't remember the last time someone beat you to it! <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>
    Beryl M


Posting Permissions

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