kpmsivaprakasam2003
New Member
- Joined
- Jan 28, 2020
- Messages
- 14
- Office Version
- 365
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Excel VBA code is required to Select the Name in the Data Validation list on a cell value after the same name could be run in the sub macro.
E.g. Data Validation List assigned in "Sheet3" cell text value "B2". if I select the "AA" and then Call to "AA" Sub Marco run. I got error the code line "Application.Run Text".
Below Excel VBA code here: Excel version is 2013
Private Sub Worksheet_Change(ByVal Target As Range)
'Run Macro when Drop Down value selected
'VBA to run from Data Validation
'Auto Show Drop-Down List When Selecting the Cell
If Target.CountLarge > 1 Then Exit Sub
If Target.Address = Range("B2").Address Then
Application.EnableEvents = False
Dim Text As String
Text = ThisWorkbook.Sheets("Sheet3").Range("B2").Value
Application.Run Text
'or
'If Target.Address = "$A$1" Then
'Call ThisWorkbook.Sheets("Sheet3").Range("B2").Value
'End If
End If
Application.EnableEvents = True
End Sub
Public Sub AA()
MsgBox "AA Macro"
End Sub
Public Sub BB()
MsgBox "BB Macro"
End Sub
Public Sub CC()
MsgBox "CC Macro"
End Sub
Thanks for Advance
Sivapraakasam K
E.g. Data Validation List assigned in "Sheet3" cell text value "B2". if I select the "AA" and then Call to "AA" Sub Marco run. I got error the code line "Application.Run Text".
Below Excel VBA code here: Excel version is 2013
Private Sub Worksheet_Change(ByVal Target As Range)
'Run Macro when Drop Down value selected
'VBA to run from Data Validation
'Auto Show Drop-Down List When Selecting the Cell
If Target.CountLarge > 1 Then Exit Sub
If Target.Address = Range("B2").Address Then
Application.EnableEvents = False
Dim Text As String
Text = ThisWorkbook.Sheets("Sheet3").Range("B2").Value
Application.Run Text
'or
'If Target.Address = "$A$1" Then
'Call ThisWorkbook.Sheets("Sheet3").Range("B2").Value
'End If
End If
Application.EnableEvents = True
End Sub
Public Sub AA()
MsgBox "AA Macro"
End Sub
Public Sub BB()
MsgBox "BB Macro"
End Sub
Public Sub CC()
MsgBox "CC Macro"
End Sub
Thanks for Advance
Sivapraakasam K