It is very simple, but the final code will depend on where you want to save the new values. For example, if you want to keep the values ββdivided by 2 in the following column:
Sub test() Dim cell As Range For Each cell In Range("A1:A5") cell.Offset(, 1).Value = cell.Value / 2 Next End Sub
Remember that there are more effective ways to do this than using offset if your range is large, but for a smaller range this is acceptable and fast.
If you want to overwrite the values, you can simply use cell.Value
instead of cell.Offset(,1).Value
aevanko
source share