+ Reply to Thread
Results 1 to 5 of 5

Worksheet_SelectionChange

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Worksheet_SelectionChange

    I want to run the routine CommCalc when the contents of the range "Exec" changes. "Exec" has a drop down-list of names which I use to do various lookups. This code does not work?

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Application.ScreenUpdating = False
        Dim MRange As Range
        Set MRange = Range("Exec")
        Call CommCalc
    End Sub
    Thanks in advance
    Last edited by Aland2929; 03-04-2011 at 12:23 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,241

    Re: Worksheet_SelectionChange

    Try

    If Not Intersect(Target, Range("Exec")) Is Nothing then
         Call CommCalc
    End if
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Worksheet_SelectionChange

    try:
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim MRange As Range
    Set MRange = Range("Exec")
    
    If Not Intersect(Target, MRange) Is Nothing Then
        Call CommCalc
    End If
    
    End Sub
    Edit: Damn you MarvinP . Your quicker on the draw then me.
    Last edited by stnkynts; 03-04-2011 at 12:13 PM. Reason: too slow

  4. #4
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Smile Re: Worksheet_SelectionChange

    Thank you very much. Works perfectly.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,241

    Re: Worksheet_SelectionChange

    I was 6th on the draw, my last post. AND it had already been marked as Solved. Now, lets hope this is what the OP wanted.

+ 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