Identifying Rows in Range with zero sums.

ERLoft

Board Regular
Joined
Feb 24, 2006
Messages
193
I'm working to run through a range of Rows (62 in total) to see which ones have zero values. Those that have values will be copied and placed elsewhere. However, I'm running into issues getting things to sum.

I've tried a few versions, none of which are working. Getting error 438 with this version. Any help would be much appreciated.

VBA Code:
Dim RowNumber As Long
For RowNumber = 3 to 65 Step 1
     If Application.Worksheetfunction.Sum(Range("BC" & RowNumber & ":BM" & RowNumber) <> 0 Then
          Range("BC" & RowNumber & ":BM" & RowNumber).Copy
          Move data where it needs to go here.
     End If
Next RowNumber
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You are missing a right parenthesis:
Rich (BB code):
     If Application.WorksheetFunction.Sum(Range("BC" & RowNumber & ":BM" & RowNumber)) <> 0 Then
 
Upvote 0
Interesting. I wasn't missing it on my version in Excel, but that did give me an idea. I'm still getting an error with this code:

Rich (BB code):
If Application.WorksheetFunction.Sum(Range("BC" & RowNumber & ":BM" & RowNumber)) = 0 Then

But was able to do a workaround by assigning the sum to a variable, then checking if the variable is zero.

Thanks for your help!
 
Upvote 0
You are welcome.
Glad you got it figured out!
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

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