View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Scott Wagner Scott Wagner is offline
external usenet poster
 
Posts: 82
Default VBA - Move text in one cell if another cell is not blank

In a worksheet I have some cells that aren't arranged consistently that
contain product information. In most cases the cells are arranged fine, but
there are certain lines that I am having trouble with and I want to
reposition cell contents around.

In the cases I want to effect column A contains a number, in all other cases
that cell is empty. Hoping column A can be used as a "trigger" for the VBA.

Row 1 contains headers, so all this begins on row 2.

Here is the basic logic:

IF A2 is not empty THEN
Move contents of C2 to D2
Move contents of B3 to C2


Example (before):
A | B | C | D |
1 | 1 | Text1 | |
| Text2 | | |
2 | 1 | Text3 | |
| Text4 | | |
3 | 1 | Text5 | |
| Text6 | | |

Example (after):
A | B | C | D |
1 | 1 | Text1 | Text2|
| | | |
2 | 1 | Text3 | Text4 |
| | | |
3 | 1 | Text5 | Text6 |
| | | |

Thanks in advance!

Scott