Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to concatenate multiple rows in a column, without selecting each group manually


I have a list of methods for the analysis of water quality parameters,
each with a long detailed description. Somewhere before this data made
its way to me, the long descriptions were parsed into multiple cells in
the same column, and numbered in the adjacent column to the left to
indicate the order in which they would have to be put back together.
These groups range from 2 to 30 cells. I have about 14,500 records to
go through and have been trying to build a macro, either in Excel of
Acess, that will recognize that when this number goes back to 1, all
cells in the column to the right of it (description column) need to be
concatenated, up until the next 1 is reached. Each cluster has a unique
ID as well, sequentially increasing in increments of 1. This could be
another option for the macro: whenever this number increases, the
concatenation begins, then ends before the next increase. I have
limited experience with VBA and am having trouble putting this
together.

Anyone have any ideas?


--
MikeM
------------------------------------------------------------------------
MikeM's Profile: http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro to concatenate multiple rows in a column, without selecting each group manually

before and after examples would be helpful

--
Don Guillett
SalesAid Software

"MikeM" wrote in
message ...

I have a list of methods for the analysis of water quality parameters,
each with a long detailed description. Somewhere before this data made
its way to me, the long descriptions were parsed into multiple cells in
the same column, and numbered in the adjacent column to the left to
indicate the order in which they would have to be put back together.
These groups range from 2 to 30 cells. I have about 14,500 records to
go through and have been trying to build a macro, either in Excel of
Acess, that will recognize that when this number goes back to 1, all
cells in the column to the right of it (description column) need to be
concatenated, up until the next 1 is reached. Each cluster has a unique
ID as well, sequentially increasing in increments of 1. This could be
another option for the macro: whenever this number increases, the
concatenation begins, then ends before the next increase. I have
limited experience with VBA and am having trouble putting this
together.

Anyone have any ideas?


--
MikeM
------------------------------------------------------------------------
MikeM's Profile:
http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to concatenate multiple rows in a column, without selecting each group manually


Sure...here's some sample data in a zip file:


+-------------------------------------------------------------------+
|Filename: SampleData.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4898 |
+-------------------------------------------------------------------+

--
MikeM
------------------------------------------------------------------------
MikeM's Profile: http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro to concatenate multiple rows in a column, without selecting each group manually

sorry we don't get those or other files in the ms newsgroups. Care to give a
full and detailed explanation if you desire assistance.

--
Don Guillett
SalesAid Software

"MikeM" wrote in
message ...

Sure...here's some sample data in a zip file:


+-------------------------------------------------------------------+
|Filename: SampleData.zip |
|Download:
http://www.excelforum.com/attachment.php?postid=4898 |
+-------------------------------------------------------------------+

--
MikeM
------------------------------------------------------------------------
MikeM's Profile:
http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Macro to concatenate multiple rows in a column, without selecting each group manually

Mike, here a little bit of code you can try that will get you the results
your looking for. If you have any questions please post me back. Please
note changes where needed,, ie sheet name and etc.

hth Rick (Fairbanks, AK {Land of the Midnight Sun})

=================================================
Sub DeleteUnWantedRows()
Dim ws4 As Worksheet
Dim lrow As Long, cnt As Long
Dim test As Integer

Application.ScreenUpdating = False
Set ws4 = Worksheets("Sheet4")

lrow = ws4.Range("A2").End(xlDown).Row
cnt = lrow
Do
test = ws4.Cells(lrow, 1)
Do
cnt = cnt - 1
If (test = ws4.Cells(cnt, 1)) Then
ws4.Cells(lrow, 1).EntireRow.Delete
lrow = lrow - 1
Else
lrow = lrow - 1
Exit Do
End If
Loop
Loop While (cnt 2)

End Sub

============================================


"MikeM" wrote in
message ...

Sure...here's some sample data in a zip file:


+-------------------------------------------------------------------+
|Filename: SampleData.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4898 |
+-------------------------------------------------------------------+

--
MikeM
------------------------------------------------------------------------
MikeM's Profile:

http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Macro to concatenate multiple rows in a column, without selecting each group manually

Morning Mike,
Please disregaurd the first code I send you early this morning. I failed
to put in the the concatenation of the "Description field" in the code last
night. Now the macro gives the same results as your examples. Sorry about
the mistake. I guess thats what I get trying to write code after getting off
a 10 hour shift at work. If have any questions on the code, please post me
back. (See new attached marco code)

enjoy, Rick (Fkbs, Ak)

PS: Note I copied your before data to Sheet4 to run this code, if wondering
why I used sheet4.
============================================
Option Explicit

Sub DeleteUnWantedRows2()
Dim ws4 As Worksheet
Dim lrow As Long, cnt As Long
Dim test As Integer
Dim hold As String

Application.ScreenUpdating = False
Set ws4 = Worksheets("Sheet4")

lrow = ws4.Range("A2").End(xlDown).Row
cnt = lrow
Do
test = ws4.Cells(lrow, 1)
hold = ""
Do
cnt = cnt - 1
If (test = ws4.Cells(cnt, 1)) Then
If hold = "" Then
hold = ws4.Cells(lrow, 4)
Else
hold = ws4.Cells(lrow, 4) & " " & hold
End If
ws4.Cells(lrow, 1).EntireRow.Delete
lrow = lrow - 1
Else
ws4.Cells(lrow, 4) = ws4.Cells(lrow, 4) & " " & hold
lrow = lrow - 1
Exit Do
End If
Loop
Loop While (cnt 2)

End Sub

================================================

"Rick Hansen" wrote in message
...
Mike, here a little bit of code you can try that will get you the results
your looking for. If you have any questions please post me back. Please
note changes where needed,, ie sheet name and etc.

hth Rick (Fairbanks, AK {Land of the Midnight Sun})

=================================================
Sub DeleteUnWantedRows()
Dim ws4 As Worksheet
Dim lrow As Long, cnt As Long
Dim test As Integer

Application.ScreenUpdating = False
Set ws4 = Worksheets("Sheet4")

lrow = ws4.Range("A2").End(xlDown).Row
cnt = lrow
Do
test = ws4.Cells(lrow, 1)
Do
cnt = cnt - 1
If (test = ws4.Cells(cnt, 1)) Then
ws4.Cells(lrow, 1).EntireRow.Delete
lrow = lrow - 1
Else
lrow = lrow - 1
Exit Do
End If
Loop
Loop While (cnt 2)

End Sub

============================================


"MikeM" wrote in
message ...

Sure...here's some sample data in a zip file:


+-------------------------------------------------------------------+
|Filename: SampleData.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4898 |
+-------------------------------------------------------------------+

--
MikeM
------------------------------------------------------------------------
MikeM's Profile:

http://www.excelforum.com/member.php...o&userid=35502
View this thread:

http://www.excelforum.com/showthread...hreadid=552694





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to concatenate multiple rows in a column, without selecting each group manually


Worked like a charm!
Much appreciated Rick. Thanks a lot.


--
MikeM
------------------------------------------------------------------------
MikeM's Profile: http://www.excelforum.com/member.php...o&userid=35502
View this thread: http://www.excelforum.com/showthread...hreadid=552694

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
Selecting a group of contiguous rows jfg Excel Discussion (Misc queries) 1 August 7th 07 06:34 AM
Besides manually how can I delete words in multiple rows? Kelly P. Excel Discussion (Misc queries) 2 November 29th 05 02:11 PM
selecting multiple rows within a Macro Tom Ogilvy Excel Programming 0 August 30th 03 01:08 AM
selecting multiple rows within a Macro Eric Dreshfield Excel Programming 0 August 29th 03 09:14 PM
selecting multiple rows within a Macro Jean-Paul Viel Excel Programming 0 August 29th 03 09:04 PM


All times are GMT +1. The time now is 04:02 PM.

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"