Merge 1000+ cells into one

Good morning

I am really hoping someone can help me with this.

I have a worksheet with 1 column (A) and 1439 rows.  I need to combine all 
1439 of these cells into one, using the following format:
A1 & "" & A2 & "" etc.

Naturally, doing this manually would take several hours (and be extremely 
vulnerable to mistakes.)  Is there a method using VBA that I could do this?

Thanks for any ideas.

Paul
0
Utf
3/23/2010 9:59:01 AM
excel.programming 6508 articles. 1 followers. Follow

4 Replies
467 Views

Similar Articles

[PageSpeed] 5

Hi,

Try this

Sub pvans()
Dim TempString As String
Set sht = Sheets("Sheet1")
Set MyRange = sht.Range("A1:A1439")
For Each c In MyRange
    TempString = TempString & " " & c.Value
Next
Range("B1") = Trim(TempString)
End Sub
-- 
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that 
introduces the fewest assumptions while still sufficiently answering the 
question.


"PVANS" wrote:

> Good morning
> 
> I am really hoping someone can help me with this.
> 
> I have a worksheet with 1 column (A) and 1439 rows.  I need to combine all 
> 1439 of these cells into one, using the following format:
> A1 & "" & A2 & "" etc.
> 
> Naturally, doing this manually would take several hours (and be extremely 
> vulnerable to mistakes.)  Is there a method using VBA that I could do this?
> 
> Thanks for any ideas.
> 
> Paul
0
Utf
3/23/2010 10:27:02 AM
Hi Paul,

For  Column A, from row 1 to the last used row, try:
Sub Concat()
Dim MyString As String, i As Integer
With ActiveSheet
  For i = 1 To .Range("A65536").End(xlUp).Row
    MyString = MyString & """" & .Cells(i, 1).Value & """"
  Next
  .Cells(i, 1).Value = MyString
End With
End Sub

-- 
Cheers
macropod
[Microsoft MVP - Word]


"PVANS" <PVANS@discussions.microsoft.com> wrote in message news:9396295E-1A92-4FB9-9DCA-4BC1B7B0460C@microsoft.com...
> Good morning
> 
> I am really hoping someone can help me with this.
> 
> I have a worksheet with 1 column (A) and 1439 rows.  I need to combine all 
> 1439 of these cells into one, using the following format:
> A1 & "" & A2 & "" etc.
> 
> Naturally, doing this manually would take several hours (and be extremely 
> vulnerable to mistakes.)  Is there a method using VBA that I could do this?
> 
> Thanks for any ideas.
> 
> Paul
0
macropod
3/23/2010 10:29:52 AM
Thanks Mike,

Brilliant as always, works perfectly.

Thanks too you to macropod - really appreciate the assistance

Cheers, Have a nice day

"Mike H" wrote:

> Hi,
> 
> Try this
> 
> Sub pvans()
> Dim TempString As String
> Set sht = Sheets("Sheet1")
> Set MyRange = sht.Range("A1:A1439")
> For Each c In MyRange
>     TempString = TempString & " " & c.Value
> Next
> Range("B1") = Trim(TempString)
> End Sub
> -- 
> Mike
> 
> When competing hypotheses are otherwise equal, adopt the hypothesis that 
> introduces the fewest assumptions while still sufficiently answering the 
> question.
> 
> 
> "PVANS" wrote:
> 
> > Good morning
> > 
> > I am really hoping someone can help me with this.
> > 
> > I have a worksheet with 1 column (A) and 1439 rows.  I need to combine all 
> > 1439 of these cells into one, using the following format:
> > A1 & "" & A2 & "" etc.
> > 
> > Naturally, doing this manually would take several hours (and be extremely 
> > vulnerable to mistakes.)  Is there a method using VBA that I could do this?
> > 
> > Thanks for any ideas.
> > 
> > Paul
0
Utf
3/23/2010 11:32:02 AM
Glad i could help and thanks for the feedback
-- 
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that 
introduces the fewest assumptions while still sufficiently answering the 
question.


"PVANS" wrote:

> Thanks Mike,
> 
> Brilliant as always, works perfectly.
> 
> Thanks too you to macropod - really appreciate the assistance
> 
> Cheers, Have a nice day
> 
> "Mike H" wrote:
> 
> > Hi,
> > 
> > Try this
> > 
> > Sub pvans()
> > Dim TempString As String
> > Set sht = Sheets("Sheet1")
> > Set MyRange = sht.Range("A1:A1439")
> > For Each c In MyRange
> >     TempString = TempString & " " & c.Value
> > Next
> > Range("B1") = Trim(TempString)
> > End Sub
> > -- 
> > Mike
> > 
> > When competing hypotheses are otherwise equal, adopt the hypothesis that 
> > introduces the fewest assumptions while still sufficiently answering the 
> > question.
> > 
> > 
> > "PVANS" wrote:
> > 
> > > Good morning
> > > 
> > > I am really hoping someone can help me with this.
> > > 
> > > I have a worksheet with 1 column (A) and 1439 rows.  I need to combine all 
> > > 1439 of these cells into one, using the following format:
> > > A1 & "" & A2 & "" etc.
> > > 
> > > Naturally, doing this manually would take several hours (and be extremely 
> > > vulnerable to mistakes.)  Is there a method using VBA that I could do this?
> > > 
> > > Thanks for any ideas.
> > > 
> > > Paul
0
Utf
3/23/2010 11:40:01 AM
Reply:

Similar Artilces:

merging
Is it possible to create a document in publisher (mine is a certificate) and then merge the desired information from a select querry in access? Hi Tina (sttpreston@clyde.k12.oh.us), in the Microsoft� newsgroups you posted: || Is it possible to create a document in publisher (mine is || a certificate) and then merge the desired information from || a select querry in access? Yes, you can. Which version of Publisher and Windows are you using? -- Brian Kvalheim Microsoft Office Publisher MVP Official Publisher MVP Site: http://www.kvalheim.org This posting is provided "AS IS" wit...

Merge same transaction
I've had transactions that I've placed in my register with detailed info in the memo area only to have the same exact transaction download with no info and unrecognized as the same transaction. Traditionally I've copied and pasted the info into the downloaded transaction and then deleted my transaction. This is a real PAIN... Is there a way to tell Money that these two separate transactions are the SAME transaction and then have it merge them? It works exactly as intended when Money recognizes the transaction that's already in the register and then merges them beautiful...

Linking Cells: Excel into Word Document
Greetings, After reading through the help files for Excel 2002, it seems to me that there is no way, except for programming, to have just a range of cells in a worksheet be linked to a Word document. Here is what I am attemping to accomplish: Using Word to create an extensive document for a database proposal. Using Excel to document the all of the required tables (since nothing has been created in Acces and I am new databases), drawing diagrams with lines and other database objects. Would like to be able to insert/link certain cells from a worksheet (which would be many inserts/links) into t...

Returning left part of cell before a character
I have a text file report that is not customizable. I import that into Excel. There is a field where relevant data ends after the colon character ":". Can someone help me with a formula I can put in column C that evaluates the corresponding cell in column B and brings back all text to the left of the colon mark? Examples: Column B freddy: 45345 sldf jeff: 45422 fdflh sam: bfd4454 In this case I want to return the characters to the left of the colon: freddy jeff sam Thanks in Advance! Alan Hi there, You can use the formula =MID(B1,1,FIND(":",B1)-1) This wi...

Word mail merge
After printing a document there exists a activity with subject "Word Mail Merge" to the contact with status completed. Is there a possibility to change the subject name or to make a link to the original Word document? R, Joop. I think that the subjct name is hardcoded. The issue of only adding this paltry information to the activity and not showing what document was sent is a problem many have asked about. Microsofts workaround to this glaring gap in functionality is to then add a copy of the word document to the record using notes. Totally unworkable if you have just mail merg...

Moving exchange from one server to another
I have moved all mailboxes and public folders from one server to another in the same site. I had deleted items retention set to 6 month on the first server so users could retrieve deleted items from their outlook client. Now since their mailboxes are moved to the new server and they try to recover deleted items, it comes up blank. How do I move the delete items from the old server to the new one? I don't want to have to overwrite the priv.edb on the new server since it is the most recent one now. I guess you should start practicing your disaster recovery skills as it seems to be not...

Copying Cells #2
How can I copy a range of cells (some of which are filled with gray) from one worksheet to another worksheet without deleting any data that may be in the same range on the second sheet. Say the area is from A1 thru B2. Select A1 thru B2 on the first sheet and: Edit > Copy then select cell A1 only on the second sheet and: Edit > Paste Special > Formats. -- Gary''s Student - gsnu200808 "DJ" wrote: > How can I copy a range of cells (some of which are filled with gray) from one > worksheet to another worksheet without deleting any data that may be in ...

Merging 2 Companies into 1
Are there any guidelines or outline for what tables you need to look at to gather the various information you need in order to merge 2 companies together as well as issues to consider when undertaking such a project? It is a project and a half. I got approval from a major client yesterday to proceed with just this project. You literally need to look at all of them! I understand that MS Professional Services will do this project for you. In my case the client cannot be down and has too many 3rd party products for us to pass it off. When does your project need to be completed? -- Ri...

Run macro from clicking on a cell
Is there a way that you can run a macro from clicking on a specified cell with a hyperlink or function. I can use the shortcut key, but some 'here' say it is not user friendly to have to use a shortcut key. help files haven't helped. -Joe -- jrd269 ------------------------------------------------------------------------ jrd269's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23815 View this thread: http://www.excelforum.com/showthread.php?threadid=376404 jrd269 wrote: > Is there a way that you can run a macro from clicking on a specified > c...

adding data from multiple spreadsheets into one chart
I need to put information from 4 different spreadsheets into one graph. Can someone please help me? Produce a graph from your first spreadsheet. Copy the relevant data range from the second spreadsheet, then select the graph and edit/ paste special/ new series or new data points. Similarly for the third and fourth sheets. If you have difficulties getting exactly what you want that way, you can use edit Source Data in the graph to add an extra series or to change the X or Y data range for an existing sreries. -- David Biddulph "Marjory" <Marjory@discussions.microsoft.com&g...

Linked Cells #8
How do I have a link jump to the linked cell vs. showing me the contents? Without knowing exactly what you're asking, you need to hyperlink the cell you want to jump from, select Bookmark, and then enter the Cell reference that you want to jump to. "Jill" <Jill@discussions.microsoft.com> wrote in message news:227A882B-189A-4BE3-AEAE-A5C0CF6EF751@microsoft.com... > How do I have a link jump to the linked cell vs. showing me the contents? ...

cell value
I need cells to show values when a check mark is entered. Like if I check this box then the value is 1.0 - this needs to be in several columns that I can then add the values together from Hi Lisa If you're using the Checkbox from the Form toolbar, right click and go to Format Control. Under the Control, you can link to a cell, select a cell "Z1" just for illustration, you can pick any empty cell. That can be visible or not but it will return "True or False". Now the cell that will return a value, just type =if(Z1=true,1.0,""),Remember to chang...

mail merge/merging 2 address lists...
Is there a way to merge two of your address lists in Publisher 2002? I have two address lists in my data base folder and would like all the addresses merged into one as there are some addresses different in each and some the same. Thank you. Robin Hi Robin (vicary@kconline.com.NOSPAM), in the Microsoft� newsgroups you posted: || Is there a way to merge two of your address lists in Publisher 2002? || I have two address lists in my data base folder and would like all || the addresses merged into one as there are some addresses different || in each and some the same. No, you cannot. You nee...

Moving an active cell
I need a snippet of code that will (when you use ctrl-d) look at the active cell, move the cursor down 9 cells (same column) and make that cell the active cell, no matter where you start on the spreadsheet. Any ideas? Thanks to everyone. -- Howard ActiveCell.Offset(8).Select Hope this helps. Otto "Howard" <Howard@discussions.microsoft.com> wrote in message news:E4AEBCBE-AB3A-456C-81D0-2478A113B5FE@microsoft.com... > I need a snippet of code that will (when you use ctrl-d) look at the > active > cell, move the cursor down 9 cells (same column) and ...

merge and compare
We have two versions of the same work sheet from differnt dates. Some of the cells have been changed in the latest version and we need to compare which cells have had changes and selectively merge the two. Is there any hope??? jimired wrote: > We have two versions of the same work sheet from differnt dates. > > Some of the cells have been changed in the latest version and we need > to compare which cells have had changes and selectively merge the two. > > Is there any hope??? Hi have a look at http://www.cpearson.com/Zips/Compare.ZIP An add-in which compares two worksh...

Moving email from one computer to another
How do I transfer email folders from outlook in one computer to outlook in another computer? Thanks in advance Export all your messages to a .pst file from outlook and then import them on the other from that same .pst file. File / Import Export Wizard / Export to a file / Select Personal Folder File ..pst / Select which folder has your mail / Pick the location and the name of the backup file / Then click on FINISH. I hope this helps Thanks "Mickey" <anonymous@discussions.microsoft.com> wrote in message news:022f01c3c9ac$1a01a860$a601280a@phx.gbl... > How do I transfer e...

How can I get bar codes w/ Excel & mail merge?
I want to send out a bulk mailing with large postcards. I want the addresses printed on the postcards via mail merge. I am using Excel, but don't see where or how to add the bar code to the address, which would save me a lot of money. Can you help? >-----Original Message----- >I want to send out a bulk mailing with large postcards. I want the addresses >printed on the postcards via mail merge. I am using Excel, but don't see >where or how to add the bar code to the address, which would save me a lot of >money. Can you help? >. > hi, I not entirely...

Deleting Parts of Cells
I have a list of information in a column. All the information has the format of having numbers and letters then a / and more data. I only want to look at the data to the left of the /. So, I would like the data to the right of the / deleted, including the /. For example, I need YYY9/5 to read YYY9. Any suggestions? You could bring it into Excel as a txt file open the txt file in excel Text Import Wizard will appear select >delimited check > other and type the "/" into the box finish you should have a separation where the / was. "GOL" wrote: >...

Merging worksheet into MS Word mail merge
I am merging a letter and an Excel worksheet. When I merge an Excel field that contains $ and commas separating the hundreds and thousands, the $ and the , do not show up in the merged letter. Any suggestions on how to solve this problem? -- Briggs Hi Instead of just referring to the cell e.g. A1 use =TEXT(A1,"[$$-409]#,##0.00") -- Regards Roger Govier "Briggs" <Briggs@discussions.microsoft.com> wrote in message news:2F326201-A50F-45E5-9767-4C189ACA5529@microsoft.com... > I am merging a letter and an Excel worksheet. When I merge an Exc...

I Need to change reference sheet for all cells on a form
Good afternoon, I am copying a spreadsheet to make summary sheet and I need to change which sheet the cells are referncing on my copy. Some of the cells refer to for example, =PRIOR YEAR!B3, some of the cells use a command to Round(PRIOR YEAR!B3/100), I would like to change all the references that currently refer to "PRIOR YEAR" sheet and make them "CURRENT YEAR" sheet, so my references would look like this =CURRENT YEAR!B3 and Round(CURRENT YEAR!B3/100). I am curious if a paste special, or shortcut exists that can do this quickly so I dont have to go in and manual...

Printing Patterns in Cells
Hell, I am trying to print a worksheet I created with colors and patterns. The colors print, but the patterns don't. They show up in print preview. Can anyone enlighten me please? Oh, and is there a limit to the width of a worksheet. Mind will only go as far as column IV. Thanks for your help Patty ...

Tab
Tab is supposed to move one cell to the right. Mine moves from column A to S, to AK to BC and so on. It always moves in hughe ranges. The arrow works, however, I am used to the TAB and want to continue using that. Ther is nothing in the set-up screens that would indicate this possibility. What am I doing wrong? -- Thanks for helping Click on Tools/Options in Excel's menu bar, then select the Transition tab and uncheck the CheckBox labeled "Transition navigation keys". Rick "Dies-und-Das" <DiesundDas@discussions.microsoft.com> wrote in message news:E119...

fill random cells in an area
hi! I have this problem: in one sheet a have 4 values (in the columns ABCD row1) and I want to use this 4 values to fill randomly 4 of those 20 cells of the range A1:A20. How to do this? Thank you!:confused: --- Message posted from http://www.ExcelForum.com/ i forgot something: range A1:A20 is in a new sheet not in the same shee with the values. Sorry -- Message posted from http://www.ExcelForum.com ...

Cell Range Names
I've looked around, but can't find if it's possible for me to "Lookup" in column of cells based on group criteria and automatically add a Range Name to them. I'm busilding a business spreadsheet that has numbered day of the month in column A and the related day name in column B. A B 1 Sat 2 Sun 3 Mon I want to do comparisons with previous years same "Weeks", like "week 1", "week 2", etc. starting from the first Saturday of the year to the last Friday of the year. I need to figure out how to lookup, group and automa...

Error in Mail Merge when selecting Edit Individual Labels
We are noticing an interesting error when trying to perform a mail merge within CRM and Microsoft Word. We have created a view in contacts and we perform all the typical mail merge functionality using the Labels option. At the end, instead of printing the labels without any edits, we click on “Edit Individual labels” and we get the following error… C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE has encountered a problem and needs to close. We are sorry for the inconvenience. We are on CRM v4 Update Rollup 8 using Outlook 2007 and the CRM Outlook (Online only) client. Has an...