MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Duplicating information.....hellllllp!!!

Posted by Dan on February 27, 2001 6:55 AM

Can you help me with some code that tries to duplicate data spread over various lines in column B to one line in Column C!!!

Sub MergeCells()
Dim startCell As Range, destCell As Range
Dim rng As Range, sourceCell As Range
Set startCell = Range("B2")
Set destCell = Range("C2")
Set rng = Range(startCell, startCell.End(xlDown))
For Each sourceCell In rng
destCell.Value = destCell & " " & sourceCell
Set startCell = startCell.End(xlDown).End(xlDown)
Set rng = Range(startCell, startCell.End(xlDown))
Set destCell = startCell.Offset(0, 1)
Loop While destCell.Row <> 65536
End Sub

It worked really well until row 758. Then I got a message saying "Run-time error 13: Type mismatch". It seems to be having problems with the line :

I'd appreciate any help!!


Posted by Carl B on February 28, 2001 12:27 AM

It is working well, you are running into the limit for what that type of cell can handle as a string, not sure how you can set that to handle larger strings, maybe set it as a Double?? somehow

Posted by Dan on February 28, 2001 1:25 AM

It's it working!!!

Thanks for your help anyway!!