View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Crowbar via OfficeKB.com Crowbar via OfficeKB.com is offline
external usenet poster
 
Posts: 128
Default VBA - Move text in one cell if another cell is not blank

I have tested this and it worked fine. Don't know how clued up on this you
are so here are a few things:

If you place this within you worksheet it will activate evertime you open it,
if you don't want this then change the sub name to something else.

This current sub will only work on a sheet named Sheet1, if your sheet is
called something else then rename sheet1 (on the thrid line) to
Sheets("YOUR SHEET NAME")

Please note that this ONLY does as you stated, which is: -

If Ax is empty then
Cx is put into Dx and
Bx + 1 is put into Cx


Sub auto_open()

For x = 1 To 65536
If Sheet1.Cells(x, 1).Value "" Then
Range("C" & x).Cut
Range("D" & x).Select
ActiveSheet.Paste

Range("B" & x + 1).Cut
Range("C" & x).Select
ActiveSheet.Paste
End If
Next x

End Sub


Regards Crowbar

Email:

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1