VBA Error

Lelewiwi

Board Regular
Joined
Nov 8, 2023
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Hello helpful peeps! I have a massive macro that is run every month on files that are received from an outside source. It worked last month, but this month I received an error. The file received has not changed, nor has the code. I don't get it. Any help is appreciated! The line where the code is red.

Rich (BB code):
    'Clean and set up EB Other Locals Adjustment workbook
        Dim lr8 As Long
        Dim lr9 As Long
        Sourcewb2.Activate
        Columns("D").Delete

    'Filter, copy, paste
        lr8 = Cells(Rows.count, "A").End(xlUp).Row
        Columns("K:K").AutoFilter
        ActiveSheet.Range("$A$1:$P$" & lr8).AutoFilter Field:=11, Criteria1:="<0"
        Range("$A$1:$P$" & Cells(Rows.count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy
        ThisWorkbook.Activate
        Sheets("Eastbay Adjustments").Select
        lr9 = Cells(Rows.count, "A").End(xlUp).Row
        Cells(Rows.count, 1).End(xlUp).Offset(2, 0).PasteSpecial xlPasteValues
        Application.CutCopyMode = False
 
Last edited by a moderator:
Ok, so that is changed. What about the Dbox.SelectedItems.Count? Those are the only one that are in the actual module that is the issue.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
No, that is the built-in "Count" property, not a user-created variable.

Note on the other one, the variable declaration is a dead give-away.
You only use the word "Dim" to declare user created variables.
 
Upvote 0
Ok. I'm still getting the error and really need to get this fixed ASAP. Any other ideas?
 
Upvote 0
I am afraid that we probably cannot do anything else without having access to your files.
If you can upload a copy of them to a file sharing site (being sure to remove any sensitive information first), and post the link here, we may be able to take a look at it for ourselves and find where the issue is.
 
Upvote 0
Unfortunately, I cannot do that due to HIPPA restrictions. All I can due to post the entire code here.
 
Upvote 0
Unfortunately, I cannot do that due to HIPPA restrictions. All I can due to post the entire code here.
That is why I said remove all sensitive data first.
I am familiar HIPPA requirements. It is not too hard to "dummy up" the data by removing/replacing all the HIPPA data with made up stuff.
 
Upvote 0
Can you try replacing this line:
VBA Code:
      Columns("K:K").AutoFilter

With these lines
VBA Code:
        If ActiveSheet.FilterMode = True Then
            ActiveSheet.ShowAllData
        End If
 
Upvote 0
Solution
I believe that seems to imply that your data was already filtered, which I asked about way up in post 8!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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