# Macro Sumif

#### slamcity

##### New Member
I am having a problem when I run a macro with the Sumif equation in certain cells changing. The macro that I run copies data from one sheet, pastes it to another and manipulates the data (deletes columns and rows and adds a column from which one of the cells on the macro page is referenced).

For some reason, every time the macro is run, the cell reference moves one column over (for instance, if original reference is F:F, the equation changes to E:E every time macro is run).

I have already tried to absolutel reference these column references with no luck.

If anyone can think of anything to help, it would be much appreciated. Thanks a lot!!

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

#### acw

##### MrExcel MVP
Hi

Without seeing your code it is a bit hard to tell, but do you take a copy of the function after you have deleted the column? And is the deleted column before column F?

Tony

#### slamcity

##### New Member
Here is a copy of the code for the macro:

Application.ScreenUpdating = False

Sheets("ORIGINAL").Select
Cells.Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
Rows("1:3").Delete Shift:=xlUp
Columns("A:A").Delete Shift:=xlToLeft
Rows("2:2").Delete Shift:=xlUp
Range("G1").EntireColumn.Insert
Range("g1").Select
ActiveCell.FormulaR1C1 = "ABS"
Range("G2").FormulaR1C1 = "=ABS(RC[-1])"
Range("G2").AutoFill Destination:=Range("G2:G924")
Cells.Select

Application.ScreenUpdating = True

End Sub

Now here is a copy of the Sumif equation from the other sheet which references info from the Inv Adjs sheet:

- The column reference that changes every time the macro is run is "D" in this case, but the "I" column doesn't change at all.

#### acw

##### MrExcel MVP
Hi

Ran the code and it didn't seem to change the formula in any way.

Is there more code involved?

Tony

Replies
2
Views
283
Replies
10
Views
452
Replies
18
Views
564
Replies
7
Views
135
Replies
3
Views
472

1,171,060
Messages
5,873,543
Members
432,982
Latest member
meepio

### 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.

### Which adblocker are you using?

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

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