Posts by ajaydand65

    Re: Worksheet change macro handling error - Newbie


    Hi RoyUK,


    Thanks for your response. It worked, but not exactly as you suggested. It was throwing error of No such Function or Sub, without the Run. However, when I changed it to Run ("mSetGSTRate"), and also made the code name different, it worked. So for the moment, it is working. Thanks again for your suggestions.

    Hi,
    I'm trying to create a macro which calculates the Tax rate based on following criteria - a) Determine whether it is intra-state or inter-state tax, based on comparison of code value in certain cells, b) Based on tax rate selected from a drop down list, update rate column for either intra-state tax or inter-state tax. Further this macro should run, whenever there is a change in selection of drop-down list value, provided the quantity and rate cell values are not empty. Here is the macro code:



    Additionally, I am trying to call the macro on worksheet_change event, like this:


    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Range(Target.Address), Range("K18:K31")) Is Nothing Then
            Application.EnableEvents = False
            Application.Run "mSetGSTRate"
            Application.EnableEvents = True
        End If
    End Sub


    I am having mixed luck with the macro. It does not update every time the value is changed in the drop down list cell, which falls within the range K18:K31. Moreover, the worksheet_change event throws up an error - "Error 1004 - Cannot run macro 'mSetGSTRate' Either the macro may not be available in this workbook or all macros may be disabled."


    The macro is saved as module with code name same as procedure name in the modules section. The worksheet_change code is saved under the worksheet code section, which has been given code name shInv1


    Please bear for any silly mistakes or newbie errors. Thanks for help in advance.


    Ajay Dand.