Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Combining / Merging several rows - but want to keep formatting

Help - please !
I have exported out of a database, saved as a TXT file, and brought into
Excel a large set of overview text (approx. 7000 records). Unfortunately,
the overview text has separated into rows rather than stay together as one
large overview text.

The text can be 2-25 rows and is separated from the next by a blank row.
Is there a way to capture the text from the next line, ALT_Enter it into the
first line so it appends and keep doing this for each subsequent row until
the blank row is reached (indicating a new overview is about to follow).

I've tried merging, but it makes one long row and loses formatting. With
bullet points in the overview, among other items, it makes it look like a
huge mess.

Thank you in advance!
Gene
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Combining / Merging several rows - but want to keep formatting

So you have one giant column (A) of data? Nothing anywhere else???

If yes:

Option Explicit
Sub testme()
Dim myCell As Range
Dim myRng As Range
Dim myArea As Range
Dim wks As Worksheet
Dim myStr As String

Set wks = Worksheets("sheet1")

With wks
Set myRng = Nothing
On Error Resume Next
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
End With

If myRng Is Nothing Then
MsgBox "No constants in column A!"
Exit Sub
End If

For Each myArea In myRng.Areas
myStr = ""
For Each myCell In myArea.Cells
myStr = myStr & vbLf & myCell.Value
Next myCell
If myStr < "" Then
myStr = Mid(myStr, 2)
End If
myArea.Cells(1).Offset(0, 1).Value = myStr
Next myArea

'positive that it worked???
'wks.Columns(1).delete
'or delete column A manually

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



Nameofgene wrote:

Help - please !
I have exported out of a database, saved as a TXT file, and brought into
Excel a large set of overview text (approx. 7000 records). Unfortunately,
the overview text has separated into rows rather than stay together as one
large overview text.

The text can be 2-25 rows and is separated from the next by a blank row.
Is there a way to capture the text from the next line, ALT_Enter it into the
first line so it appends and keep doing this for each subsequent row until
the blank row is reached (indicating a new overview is about to follow).

I've tried merging, but it makes one long row and loses formatting. With
bullet points in the overview, among other items, it makes it look like a
huge mess.

Thank you in advance!
Gene


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging Data in Different Rows crcurrie Excel Discussion (Misc queries) 8 May 5th 07 11:19 PM
how to keep excel formatting when merging to word? Kelzina Excel Discussion (Misc queries) 1 January 1st 07 09:14 AM
Merging rows Peter Horrocks New Users to Excel 1 November 15th 05 12:01 PM
Merging Two Rows Into One Ourania Excel Worksheet Functions 1 March 18th 05 10:07 AM
Formatting for merging into Word Shawna Excel Discussion (Misc queries) 0 February 24th 05 10:21 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"