+ Reply to Thread
Results 1 to 6 of 6

Worksheet_Change

  1. #1
    Dan
    Guest

    Worksheet_Change

    Using

    Private Sub Worksheet_Change(ByVal Target As Range)

    How do you select a perticular range like b5 - b15

    found for a single cell but not a range

  2. #2
    Kevin O'Neill
    Guest

    Re: Worksheet_Change

    I'm a newbie but, I used this for one of my worksheet change events. If
    you have it set for a single cell. Target = Range("B5"), could you not
    just use Range("B5:B15") ?

    Dim myrow&, myCol&
    myrow = Target.Row
    myCol = Target.Column

    If myrow > 0 And myrow < 100 Then
    If myCol > 0 And myCol < 100 Then


  3. #3
    Bob Phillips
    Guest

    Re: Worksheet_Change


    If Not Intersect(Target,Range("B5:B15)) Is Nothing Then
    'it is one of B5:B15


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Dan" <Dan@discussions.microsoft.com> wrote in message
    news:3D1AF1E2-4D06-485F-868F-20C8D84EBA55@microsoft.com...
    > Using
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > How do you select a perticular range like b5 - b15
    >
    > found for a single cell but not a range




  4. #4
    Tom Ogilvy
    Guest

    Re: Worksheet_Change

    Private Sub Worksheet_Change(ByVal Target As Range)
    if Union(Target,Range("B5:B15")).Address = "$B$5:$B$15" then


    end if
    End Sub

    if you want to react to only a change in a single cell in the Range B5:B15

    Private Sub Worksheet_Change(ByVal Target As Range)
    if Target.count > 1 then exit sub
    if Not Intersect(Target,Range("B5:B15")) is nothing then


    end if
    End Sub


    --
    Regards,
    Tom Ogilvy

    "Dan" <Dan@discussions.microsoft.com> wrote in message
    news:3D1AF1E2-4D06-485F-868F-20C8D84EBA55@microsoft.com...
    > Using
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > How do you select a perticular range like b5 - b15
    >
    > found for a single cell but not a range




  5. #5
    Dan
    Guest

    RE: Worksheet_Change

    Thanks for looking, got it:

    Set myRange = Intersect(Range("b5:b15"), Target)
    If Not myRange Is Nothing Then
    ' your code
    End If

    Cheers


    "Dan" wrote:

    > Using
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > How do you select a perticular range like b5 - b15
    >
    > found for a single cell but not a range


  6. #6
    Gary''s Student
    Guest

    RE: Worksheet_Change

    Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Intersect(Range("A2:A10"), Target) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Target.Value = Target.Value * 0.3
    Application.EnableEvents = True
    End Sub

    This looks for changes in a certain range
    --
    Gary's Student


    "Dan" wrote:

    > Using
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > How do you select a perticular range like b5 - b15
    >
    > found for a single cell but not a range


+ 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