Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Concatenate 12 Adjacent Rows into First Cell in Row


Hi:

I have a workbook with about 150 worksheets in it. Each worksheet has
12 rows of text with a limit of 72 characters per row. (I use these
"templates" to enter text and then cut and paste the text from the 12
rows into an old mainframe database.)

In early 2005, the mainframe will be modified to allow text of any
width to be pasted into it. So, I'm going to want to take the contents
of the 12 rows and "merge" them into the first row. (It's just so much
easier allowing text to wrap...than using a 12 row text input system.)
I cannot use Excel's merge function as it only keeps the text in the
upper left cell.

I'm assuming this must be fairly simple to do. I simply want to create
a macro and apply it to a number of worksheets. (It's not a big deal
for me to apply the macro to each worksheet individually versus all at
once - as I will only need to do it once.)

Any help would be appreciated.
__________________________________________________

I'm also curious if the reverse is easy to do. i.e. If I made the
change now and started entering text into a single cell limited to (eg.
864 characters), is there a simple macro that I could use to
deconcatenate the single cell and place the results in a separate 12
row worksheet with each cell limited to 72 characters - or even simply
place the "results" into the Windows clipboard? I would not *need * the
functionality to split single words (with a hyphen) onto two lines. I'd
simply need whole words that couldn't fit on one line to be moved to
the next line. I realize that it may be the case that the full 864
characters might not fit on the 12 lines, but I could just have an
error message pop-up if that were the case.

Dave


--
snsd
------------------------------------------------------------------------
snsd's Profile: http://www.excelforum.com/member.php...o&userid=15910
View this thread: http://www.excelforum.com/showthread...hreadid=319443

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Concatenate 12 Adjacent Rows into First Cell in Row

snsd wrote:
I have a workbook with about 150 worksheets in it.
Each worksheet has 12 rows of text ..



Sub zMerge() ' merges A1:A12 into A1
Dim isheet%, irow&, icol%, s1$, s2$
icol = 1
For isheet = 1 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(isheet).Select
MsgBox "Now doing sheet " & _
ActiveWorkbook.Sheets(isheet).Name
For irow = 1 To 12
s1 = ActiveWorkbook.Sheets(isheet).Cells(irow, icol)
If irow = 1 Then
s2 = s1
Else
If s1 < "" Then s2 = s2 & " " & s1
End If
ActiveWorkbook.Sheets(isheet).Cells(irow, icol) = ""
Next irow
ActiveWorkbook.Sheets(isheet).Cells(1, 1) = s2
Next isheet
End Sub


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
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
Add cells on two adjacent rows but non-adjacent columns Eve Excel Worksheet Functions 14 October 20th 09 02:32 AM
Compare adjacent fields in adjacent rows Quimera New Users to Excel 6 May 30th 08 11:36 AM
Concatenate multiple rows and columns into 1 cell mj44 Excel Discussion (Misc queries) 21 July 19th 07 09:18 AM
How do I Select Multiple Non Adjacent Rows based on a cell value? avalynch Excel Worksheet Functions 2 October 1st 06 07:45 PM
How to concatenate adjacent cells in a range without using &? Ark Excel Worksheet Functions 4 October 16th 05 06:38 PM


All times are GMT +1. The time now is 07:48 AM.

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

About Us

"It's about Microsoft Excel"