Add a value and an offset value

I3atnumb3rs

New Member
Joined
Nov 2, 2018
Messages
34
Hello,

Trying to loop through the B column and when there's a certain string I want to enter a fixed value in column H, but when it's case REGULAR DELIVERY PV I also want to add the value of the j column to the fixed value. I know I need to do an offset but my code doesn't seem to work. Please help :)

Sub PriceChange()





Dim x As Long

For x = 2 To Cells(Rows.Count, "B").End(xlUp).Row
Select Case UCase(Cells(x, 2))

Case "FLY BY"
Cells(x, 8).FormulaR1C1 = 25
Case "MERGE"
Cells(x, 8).FormulaR1C1 = 25
Case "CANCELLED"
Cells(x, 8).FormulaR1C1 = 15
Case "REGULAR DELIVERY PV"
Cells(x, 8).FormulaR1C1 = 250 + ActiveCell.Offset(0, -2)

End Select
Next x

End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
try
250+cells(x,10)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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