Avatar of Cihla
CihlaFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Howto sort and merge the data.

Hi experts,
I have this weird database receiving every month. With its' length is changing so I can't make a simple macro that would sort the data for once. I wonder if it's possible to sort the data according to headers. E.g. if header = header copy data in to column 1, with all it's data until end row and so on. I attached the file for an idea how does it looks like.
Cihla

Test-Data.xls
Visual Basic Classic

Avatar of undefined
Last Comment
Cihla
Avatar of TRobinJames
TRobinJames

Is this example the data you want to read?  If so, how do you want it to look?
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Yes, that's the data I would like to read. I would like to keep data E.G.all supplier numbers,  in one column. So there will be a column for each kind of data. Hope it makes sence.
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Easily said, I would like to join all columns that are doubled below the first row. And if the column is not doubled I would like to keep it as it is.
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Here is a file with sample how I would like it to be done. I was trying to implement it but it's too dificult for me. I think the best way how to do it it to search for the headers and if matched copy the files in to the separate worksheet. Hope you can help.
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Forgot to attached it
Test-Data.xls
ASKER CERTIFIED SOLUTION
Avatar of ExcelGuide
ExcelGuide
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Yes, it does but it was submited 4 days ago and I hanged my mind about the data are going to be handled.
Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Possible solution:
Posted by Psychotec
Sub SearchCopy()
Dim mySearch(1 To 5) As String
 
mySearch(1) = "SupplierCode"
mySearch(2) = "ClaimNumber"
mySearch(3) = "ClaimYearMonth"
mySearch(4) = "PrimaryFailedPart"
mySearch(5) = "VIN"
 
 
For i = 1 To 5
    Cells.Find(What:=mySearch(i), After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=True, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Cells.Find(What:=mySearch(i), After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=True, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    ActiveSheet.Paste
Next i
End Sub 
Open in New Window 

Open in new window

Avatar of Cihla
Cihla
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo