Hello I want to run a macro "with commandbutton" over a selection of cells instead of a single cell.
The code shown below works but for a single cell, however I want it to run over a selection.
P.s. I am only showing 1 If statement in the code there are 100 of them.
Private Sub CommandButton1_Click()
x = ActiveCell.Value * 2
If x > 0 And x < 200 Then
y = 290
End If
ActiveCell.Offset(0,1) = y
I want the the macro to run over a selection of cells.
I've tried: Selection.Offset(0,1)
but that didn't work