Most valuable professional
  • Hot Topics

Excel Help creating what I think will be a for/next loop with an if/then statement

All, I have a spreadsheet with three columns, call them add1, add2, and add3. Column add1 always has data in it. Column add2 sometimes has data in it, column add3 also sometimes has data in it. I need to write something that will move (cut/paste) the data from column add3 into add2, but only if there is no data in add2. I have the following below, which is functional, but since we never know how many rows of data are in the sheet, I don't want to make 500 rows of the same code. If Cells.Range("B2").Value = "" Then Cells.Range("C2").Cut Destination:=Range("B2") If Cells.Range("B3").Value = "" Then Cells.Range("C3").Cut Destination:=Range("B3") If Cells.Range("B4").Value = "" Then Cells.Range("C4").Cut Destination:=Range("B4") If Cells.Range("B5").Value = "" Then Cells.Range("C5").Cut Destination:=Range("B5") If Cells.Range("B6").Value = "" Then Cells.Range("C6").Cut Destination:=Range("B6") If Cells.Range("B7").Value = "" Then Cells.Range("C7").Cut Destination:=Range("B7") If Cells.Range("B8").Value = "" Then Cells.Range("C8").Cut Destination:=Range("B8") If Cells.Range("B9").Value = "" Then Cells.Range("C9").Cut Destination:=Range("B9") If Cells.Range("B10").Value = "" Then Cells.Range("C10").Cut Destination:=Range("B10") Please help me impress my boss!!! Thanks!!! Excelnovice1111

This question generated 12 answers. To proceed to the answers, click here.

This thread is current as of September 24, 2015.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel