Macro to change entries in last column to a sum formula.

jamesbyrne

New Member
Joined
Mar 12, 2010
Messages
5
Hi,

I am trying to create a macro to change cells in the final colum in all worksheets whith a sum formula if they already contain a numerical entry. The formula will sum from column c to the second last column (left adjacent) in the same row.

Here is where I'm at so far which I'm thinking is a fair bit off. Any help is greatly appreciated.

Code:
Sub delete_rows()
Dim rw As Long, i As Long
rw = Cells(Rows.Count, 1).End(xlUp).Row
For i = rw To 9 Step -1
 If Application.Sum(Cells(i, 3).Resize(1, 7)) = 0 Then
    Rows(i).Delete
 End If
Next
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Apologies - please ignore the code in this post as it is for a different macro. I do not have the facility to delete it. I am still trying to create the macro as stated in the first post.
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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