Unable to run the Private Sub Worksheet_Change(ByVal Target As Range) Macro

  • Hi I am new to Macros and sorry if was unable to explain my doubt clearly.
    I am creating a excel for customer support.
    It has an drop down option in cell "C5" with values like "Inquiry","Cancel","General". So when user selects an option a specific shape (like the one in "INSERT - SHAPES") appears until now it is fine.
    The problem is i want to create a similar type of option in Cell "C10". so i copy, pasted and edited the same but when i try to change the value in "C5" i am getting an error As "Compile Error : Ambiguous name detected : Worksheet-change"

    "I know that it is saying as the name cannot be the same but when i change it the Macros is not working"


    Below is the code i used :



    Also can this code be run from Module ??


    Thanks in advance !!

  • Re: Unable to run the Private Sub Worksheet_Change(ByVal Target As Range) Macro



    Quote

    can this code be run from Module


    Not as Event code - you can add it to a module but you need to add code to the Event handler to call the procedure.

  • Re: Unable to run the Private Sub Worksheet_Change(ByVal Target As Range) Macro


    Wow !! You are Awesome !! Thanks for the great help !!
    However i have a small doubt the cells "C5" and "C9" will be blank at times, so when that happens this code should not run or in other words this code should be skipped.

  • Re: Unable to run the Private Sub Worksheet_Change(ByVal Target As Range) Macro


    I am so sorry for troubling you !! As i said earlier i am really new to Macro !! The code i wrote was all from online reference !! So it will be really nice if you could send me the code !!
    Once again sorry for troubling you !!

  • Re: Unable to run the Private Sub Worksheet_Change(ByVal Target As Range) Macro


    A snippet only...


    Code
    Select Case True 
        Case Not Intersect(Target, Range("C5")) Is Nothing 
            If Range("C5") <> vbNullString then
                '// Code
            End If

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!