I Recv this macro
Sub STEP9()
Dim fPath As String, wb As Workbook, r As Range
fPath = ThisWorkbook.path
Set wb = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Files\PL.xlsx")
With wb.Sheets(1)
For Each r In .Range("B2", .Cells(Rows.Count, 2).End(xlUp))
If r.Value > 0 Then
.Range(r, .Cells(r.Row, Columns.Count)).ClearContents
End If
Next
End With
wb.Close True
End Sub
I changed this macro as per my needs
Sub STEP9()
Dim fPath As String, wb As Workbook, r As Range, Ws1 As Worksheets
fPath = ThisWorkbook.path
Set wb = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Files\PL.xlsx")
Set Ws1 = wb.Worksheets.Item(1)
With Ws1
For Each r In .Range("B2", .Cells(Rows.Count, 2).End(xlUp))
If r.Value > 0 Then
.Range(r, .Cells(r.Row, Columns.Count)).ClearContents
End If
Next
End With
wb.Close True
End Sub
& i got error
Run time error 13, type mismatch Error
& Highlighted line is
Set Ws1 = wb.Worksheets.Item(1)
Bookmarks