mardi 7 novembre 2017

If statement shifting cells

I currently have this If MsgBox Statement. If vbYes is selected, it will edit cell H8, if vbNo is selected, it will edit a cell 3 below that (H11).

If MsgBox("Is X? ", vbYesNo, "Confirm") = vbYes Then
'do this to cell H8
'do this to cell h9
else
'do this to cell h11
'do this to cell h12
end if

The edits are the same - the only difference is the cell is offset 3 cells down. In this example I only use H8 and H9 but in my data there are many more cells being updated. This makes my code messy. Is there an easy way to consolidate this?

Aucun commentaire:

Enregistrer un commentaire