I am trying to run this sheet code and keep getting the error below. Any idea what I did wrong?
>>> use code - tags <<<
>>> use code - tags <<<
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Call Macro1 'event runs when cell A9 is double click
Call Macro2 'event runs when cell A10 is double click
End Sub
Private Sub Macro1(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$A$9" Then
Dim strCellName As String
Dim strReplace As String
strCellName = Target.Value
If InStr(1, strCellName, "@Para1") > 0 Then
strReplace = InputBox("Enter Floc like % OR % (Wildcard)")
If strReplace = "" Then
Cancel = True
Exit Sub
End If
strCellName = Replace(strCellName, "@Para1", strReplace)
End If
If InStr(1, strCellName, "@Para2") > 0 Then
strReplace = InputBox("Job Template like % OR % (Wildcard)")
If strReplace = "" Then
Cancel = True
Exit Sub
End If
strCellName = Replace(strCellName, "@Para2", strReplace)
End If
Call ExecSql(strCellName)
Cancel = True
End Sub
Private Sub Macro2(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$A$10" Then
Dim strCellName As String
Dim strReplace As String
strCellName = Target.Value
If InStr(1, strCellName, "@Para1") > 0 Then
strReplace = InputBox("Enter TTO like % OR % (Wildcard)")
If strReplace = "" Then
Cancel = True
Exit Sub
End If
strCellName = Replace(strCellName, "@Para1", strReplace)
End If
If InStr(1, strCellName, "@Para2") > 0 Then
strReplace = InputBox("Job Template like % OR % (Wildcard)")
If strReplace = "" Then
Cancel = True
Exit Sub
End If
strCellName = Replace(strCellName, "@Para2", strReplace)
End If
Call ExecSql(strCellName)
Cancel = True
End Sub
[code]
[ATTACH type="full" alt="71224"]71224[/ATTACH]
Attachments
Last edited by a moderator: