VBA Code s not working even though the sum of filtered values are equal to 0.

mrahulkanth

New Member
Joined
Apr 25, 2019
Messages
27
VBA Code:
Set SumRange = ReconWS.Range(Cells(2, AmountFilter), Cells(ReconRows, AmountFilter)).SpecialCells(xlCellTypeVisible)
If Application.WorksheetFunction.Sum(SumRange) = 0 Then
    ReconWS.Range(Cells(2, MatchedItem),Cells(ReconRows,MatchedItem)).SpecialCells(xlCellTypeVisible).Select
    Selection.Value = "Matched to zero"

I have written this code to verify if sum of filtered values is equal to 0 or not. Even though the sum of filtered values is equal to 0, this code is not working.
I also checked the format of filtered values - I can see that in some places the sum is 0 ; 0.00 ; (0.00). But all three formats are equal to 0 right? but the code is not working. Please help!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Do you still want help on this?

Actually the macro enabled file in which I have coded is not opening. So I’m unable to verify the suggestions what you made. Problem is file is getting opened, but when I tried to open VBA editor, file gets crashed/closed automatically. I’m trying to resolve the issue, but I couldn’t. Would you please help me on this.
 
Upvote 0
If you open Excel in safe mode, do you get the same problem?
 
Upvote 0
If you open Excel in safe mode, do you get the same problem?
Yes, @Fluff
I have tried opening the file in safe mode after changing the file name, then it worked. Thank you so much. Now I shall try all your suggestions on calculating the Sum for filtered values. :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
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