run macro from data validation drop down error

  • I have two macros that work great independently, but for some reason I can't get them to work together.


    Macro 1:
    On worksheet 1, I have a data validation drop down list in cell F2. Any time the cell is selected (regardless of content), I want it to run the same macro (the macro is named "Size"). The code I am using for that, and where I suspect the problem is, is as follows:


    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim KeyCells As Range
        Set KeyCells = Range("F2")
        Call Size
      End Sub


    Macro 2:
    This macro is the one that I have the code above calling. It works great when I call it manually, or attach it to a button, but for some reason I always get error messages when I run it from the macro above.




    The error says: "the cell or chart you're trying to change is on a protected sheet. To make a change, unprotect the sheet. You might be requested to enter a password."


    However, when I unprotect the sheet, and delete all the .protect / .unprotect tags from the code - the macro runs, but right at the end it freezes excel. I have no idea what the solution is - any help would be greatly appreciated.


    Thanks,
    D

  • Re: run macro from data validation drop down error


    just looking at the code

    Code
    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("F2")) Is Nothing Then
        Call Size
        End If
    End Sub


    and


Participate now!

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