(Solved) – Excell VBA: move column by 2 for if validation

  • by

In excel VBA, I have written the below code to sum by indentlevel. I have my indents in column B while i am calling this function from Column D.So basically my ActiveCell is column ‘D’.
Now in below condition where i am checking the cell.Indentlevel=2 i need the cell to point to column ‘B’ so i need to move the value of cell by 2 so something like,
tmpcell= cell-2 so that i can do on the validation on column B.

Dim cell As Range
for Each cell In Range(ActiveCell, ActiveCell.End(xlDown))
 If cell.IndentLevel =2 Then 
  Sumr=Sumr cell.Value
 End If
 Next cell

Can someone help as to how i can move the cell by 2 columns

Leave a Reply

Your email address will not be published. Required fields are marked *