Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Consolidate Data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AndrewJ - 09 Apr 2008 03:55 GMT
I'm looking to the experts on this one as I'm a very basic VBA user
and not sure where to start. I'm looking for some help in buildig a
macro that could do the following. Take a column of data such as below
and then Consolidate the data 50 cells at a time with the data
seperated by a semi-colon(no spaces) into 1 cell. For Instance:

            A
1        11111
2        11112
3        11113
4         .....

2223   12223

to

                      A
1       11111;11112;11113...etc
2       11151;11152;11153...etc

I'm sure there's a way to do it. I'll be honest. I have no idea where
to start. If it's not clear what I'm trying to do, please let me know.
Any help at all will be appreciated.

Thanks!
GerryGerry - 09 Apr 2008 11:47 GMT
Try the following:

Public Function consolidate(rngConsolidate As range) As String
  Dim cell As range
  consolidate = ""
  For Each cell In rngConsolidate
     consolidate = consolidate & cell.Value & ";"
  Next
End Function

> I'm looking to the experts on this one as I'm a very basic VBA user
> and not sure where to start. I'm looking for some help in buildig a
[quoted text clipped - 21 lines]
>
> Thanks!
Dave Peterson - 09 Apr 2008 13:16 GMT
Check your other post, too.

> I'm looking to the experts on this one as I'm a very basic VBA user
> and not sure where to start. I'm looking for some help in buildig a
[quoted text clipped - 21 lines]
>
> Thanks!

Signature

Dave Peterson

GerryGerry - 09 Apr 2008 16:56 GMT
Assuming the data is always in column A and the first blank cell is where
you want it to stop, the following code should do it

Public Sub consolidate()
  Dim intRowMarker As Integer, intCurrentRow As Integer, strConsolidation
As String, intCount As Integer
  intRowMarker = 1
  intCurrentRow = 1
  strConsolidation = ""
  Do
     For intCount = 1 To 50
        If (range("A" & intCurrentRow).Value = "") Then Exit For
        strConsolidation = strConsolidation & range("A" &
intCurrentRow).Value & ";"
        intCurrentRow = intCurrentRow + 1
     Next intCount
     range("A" & intRowMarker).Value = strConsolidation
     strConsolidation = ""
     intRowMarker = intRowMarker + 1
   Loop While (range("A" & intCurrentRow).Value <> "")
End Sub

> I'm looking to the experts on this one as I'm a very basic VBA user
> and not sure where to start. I'm looking for some help in buildig a
[quoted text clipped - 21 lines]
>
> Thanks!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.