Hi here im attaching input data in input sheet and output data in output sheet any one help on this im having huge data which i was attached sample one.
Going with that layout, make sure your HEADERS are in the OUTPUT sheet the way you have now, then run this, it will put the items in matching order:
Option Explicit Sub ReformatData() Dim LR As Long With Sheets("Input") LR = .Range("A" & .Rows.Count).End(xlUp).Row .Range("B2:B" & LR).FormulaR1C1 = _ "=IF(LEFT(TRIM(RC[-1]),4)=""File"", TRIM(RC[-1])& ""-""&COUNTIF(R2C1:RC1,RC1), """")" End With With Sheets("Output") LR = Int(LR / 6) + 1 .UsedRange.Offset(1).EntireRow.ClearContents With .Range("A2:F" & LR) .FormulaR1C1 = "=INDEX(Input!C1, MATCH(TRIM(R1C)&""-""&ROW(R[-1]C1), Input!C2, 0)+1)" .Value = .Value .SpecialCells(xlConstants, xlErrors).ClearContents End With End With Sheets("Input").Range("B:B").ClearContents End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks