Muhammad_Bilal
New Member
- Joined
- Sep 1, 2017
- Messages
- 14
My situation is I am opening Workbook from MS Word where I find some Text and delete entire Row of found Text.
To achieve that I am using Userform having Check-boxes and Buttons. The code below loop through all check-boxes and if checkbox.value (C.Value) Return True then it perform action by pressing CEEMEA_Button (For code see below).
I am getting Error "Run-time Error '13': Type mismatch" at
I want to bypass this Error to next line what should I do??? I tried `On Error Goto` but it did not work. Remember I am opening Excel workbook from Ms word.
To achieve that I am using Userform having Check-boxes and Buttons. The code below loop through all check-boxes and if checkbox.value (C.Value) Return True then it perform action by pressing CEEMEA_Button (For code see below).
I am getting Error "Run-time Error '13': Type mismatch" at
Code:
.Application.Cells.Find(What:=C.Caption, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
I want to bypass this Error to next line what should I do??? I tried `On Error Goto` but it did not work. Remember I am opening Excel workbook from Ms word.
Code:
Unload Me
Dim WB As Workbook
Set WB = Workbooks.Open("C:\Users\dell\Desktop\EMEA CEEMEA\EMEA CC FINAL LIST.xls")
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeName(C) = "CheckBox" Then
If C.Value = True Then
If C.Caption = "Select All" Then
Else
With WB
.Application.Sheets("Sheet2").Select
.Application.Range("A1").Select
.Application.Cells.Find(What:=C.Caption, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
.Application.ActiveCell.Rows("1:1").EntireRow.Select
.Application.Selection.Delete Shift:=xlUp
End With
End If
End If
End If
Next C
WB.Close SaveChanges:=True
Workbooks.Close
Set WB = Nothing