I have written different procedures on different worksheet in a Workbook. I want to call a particular procedure depending on the specific cell value in a worksheet.
I tried with defining a variable
So i defined a variable ‘ i ‘
i= thisworkbook.sheets("Sheet1").range("C6").value Call i
but I’m getting errors in this.
value Range C6 is changing as per contents it has array of total 32 contents, so I have written 32 procedures different. i just need to call each procedure depending on the value of ‘C6’.
Its total 32 Procedures, i can write with the IF condition but it will be too bulky so i’m trying for some easy method.
Application.Run rather than
Say we put the name of a macro in A1, then:
Sub MAIN() Dim WhichMac As String WhichMac = ThisWorkbook.Sheets("Sheet1").Range("A1").Value Application.Run WhichMac End Sub Sub MyMac() MsgBox "Hello World" End Sub
MAIN() will call the macro whose name you have placed in A1.