#### Mable

##### New Member
Hi,

I was wondering if anyone could help me? I have inserted an additional column in a spreadsheet with coding on and i need to change the references in vb but im unsure which number to change. I have inserted a new column in column 'B' so all the references need to be changed by one to make the coding work again. I have copied a small amount of the code so if someone could point me in the right direction it would help alot.

' checks if phase runs in preceeding stage for phase 1 and needs integreen including in green time calcs
If Stage = 1 And Cells(40 + Phase, 4 + Stage) = "YES" And Cells(40 + Phase, 4 + Stages) = "YES" Then
Green = Green + (Cells(33, (4 + Stage)).Value) + (Cells(34, (4 + Stage)).Value)
GoTo Skipped
' checks if phase runs in preceeding stage and needs integreen including in green time calcs
ElseIf Cells(40 + Phase, (4 + Stage)) = "YES" And Cells(40 + Phase, (3 + Stage)) = "YES" Then
'adds phase green time and preceeding intergreen time to toal value of green for phase
Green = Green + (Cells(33, (4 + Stage)).Value) + (Cells(34, (4 + Stage)).Value)
GoTo Skipped
ElseIf Cells(40 + Phase, (4 + Stage)) = "YES" Then ' if phase does not run
'adds only phase green time to toal value of green for phase
Green = Green + (Cells(33, (4 + Stage)).Value)
GoTo Skipped

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.

#### Andrew Poulsom

##### MrExcel MVP
I reckon 4 + Stage needs to be 5 + Stage, and 3 + Stage needs to be 4 + Stage.

#### Mable

##### New Member
Thanks i will give it a try

Replies
0
Views
203
Replies
12
Views
422
Replies
3
Views
316
Replies
1
Views
210
Replies
5
Views
1K

1,190,606
Messages
5,981,900
Members
439,743
Latest member
KatieO

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