View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OZDOC1050[_3_] OZDOC1050[_3_] is offline
external usenet poster
 
Posts: 16
Default macro to append one cell to another

Sub SAMPLEDATAMORE()
Range("B1").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, -1).Value = "" Then
ActiveCell.Offset(-1, 0).Value = ActiveCell.Offset(-1, 0).Value + " " +
ActiveCell.Value
ActiveCell.Value = ""
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

This is if all of col B has a value if not it will help you get on track
R
PETE

--
(][ This Email has been scanned by Norton AntiVirus. ][)
"billbeecham" wrote in message
...

Hey all....

I have never used macros before, but here goes....

I have alot of data that looks like this ( the dashes are for spacing
purposes since html is off in postings):

----A------------B--------------C
1 sample----data---------example
2 ------------more
3 sample----data---------example
4 -------------more

(no, it's not all the same info, nor always in the same place or I
would use a recorded macro)

what I need is a macro to see that A2 is empty and take cell B2 and
append the contents of cell B2 to B1 so that B1 says "data more"
instead of just "data"

and do this for the whole worksheet

I have been trying to look into copy and paste for macros, but a
straight "copy" and "paste" won't work as it will overwrite the current
contents of the cell being pasted to.

I have thousands upon thousands of lines I would like to combine
without having to do it all by hand.

Any ideas? Remember, I'm a newbie to excel, but not so new I can't
comprehend... thanks

Bill


--
billbeecham
------------------------------------------------------------------------
billbeecham's Profile:
http://www.excelforum.com/member.php...o&userid=16286
View this thread: http://www.excelforum.com/showthread...hreadid=276881