Run time error 13, type mismatch

emran06

New Member
Joined
Mar 13, 2011
Messages
27
Dear All,
I have used macro from this forum, it is working and some time appear run time error 13, type mismatch and show windows for debug. during run time error it highlighted this line- If Target = "" Then

Please help me how can I get solution.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim v As Long, ws As Worksheet
Set ws = ActiveSheet
If Target = "" Then
If sName <> "" Then
If MsgBox("Delete the sheet named """ & sName & """?" & vbLf & vbLf & "(Are you sure to delete press YES)", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hello,

Welcome to the Board!

Does this still happen with the added target.VALUE?

Private Sub Worksheet_Change(ByVal Target As Range)

Dim v As Long, ws As Worksheet
Set ws = ActiveSheet
If Target.Value = "" Then
If sName <> "" Then
If MsgBox("Delete the sheet named """ & sName & """?" & vbLf & vbLf & "(Are you sure to delete press YES)", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
 
Upvote 0
Dear Sir,
Thanks for your prompt reply. I have tried same to you but not working. Pls help me if any alternative
 
Upvote 0
Hello,

Welcome to the Board!

Does this still happen with the added target.VALUE?

Private Sub Worksheet_Change(ByVal Target As Range)

Dim v As Long, ws As Worksheet
Set ws = ActiveSheet
If Target.Value = "" Then
If sName <> "" Then
If MsgBox("Delete the sheet named """ & sName & """?" & vbLf & vbLf & "(Are you sure to delete press YES)", vbYesNo + vbQuestion) = vbNo Then
Exit Sub

Sir, I have tried but not work.
 
Upvote 0
Try this,


Private Sub Worksheet_Change(ByVal Target As Range)

Dim v As Long, ws As
Worksheet
Set
ws = ActiveSheet
If Target.Text = "" Then

If sName <> "" Then
If MsgBox("Delete the sheet named """ & sName & """?" & vbLf & vbLf & "(Are you sure to delete press YES)", vbYesNo + vbQuestion) = vbNo Then
Exit Sub<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
End Sub<o:p></o:p>


Regards,
Ogo
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,612
Messages
6,179,890
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top