About
Pricing
Community
Teams
Start Free Trial
Log in
Peter Chan
asked on
5/11/2021
Macro issue
Hi,
Can you help due to error "Subscript out of range" when running macro of attached file?
ErrorFilter.xlsm
VB Script
VBA
Microsoft Excel
Microsoft Office
4
1
Last Comment
Roy Cox
8/22/2022 - Mon
Bill Prew
5/11/2021
Try this small change:
On Error Resume Next
Sheets("Output").Delete
On Error GoTo 0
Select all
Open in new window
»
bp
ASKER CERTIFIED SOLUTION
Saqib Husain
5/11/2021
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Saqib Husain
5/11/2021
You would also have to change
If Mid(Item0, "-") > 0 Then
to
If InStr(Item0, "-") > 0 Then
Roy Cox
5/11/2021
Your code should be in a Standard Module.
I see no reason to actually delete the sheet and replace when you can simply clean up th e existing sheet.
Also, I've added a Function to save looping to check if the sheet exists.
ErrorFilter.xlsm
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Open in new window
»bp