Hi.
I have two sheets (DataBase) and (summary), i need copy by date and paste in summary.
the problem i need date arranged in a somewhat different.
look my file
Hi.
I have two sheets (DataBase) and (summary), i need copy by date and paste in summary.
the problem i need date arranged in a somewhat different.
look my file
Last edited by marreco; 06-11-2014 at 11:51 AM.
"No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.
If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.
Hi
Someone can help me?
Hi, marreco,
the basic function for what you asked could be supplied by applying a Pivot Table.
Ciao,Sub EF1017281() Dim wsDat As Worksheet Dim wsSum As Worksheet Dim lngRC As Long Dim lngArr As Long Dim var As Variant Dim varSplit As Variant Set wsDat = Sheets("DataBase") Set wsSum = Sheets("Summary") 'get relevant data according to Month With wsDat ReDim var(1 To .Range("A" & Rows.Count).End(xlUp).Row, 1 To 2) For lngRC = 2 To .Range("A" & Rows.Count).End(xlUp).Row If Month(.Cells(lngRC, "A").Value) = Month(wsSum.Range("B1").Value) Then For lngArr = LBound(var) To UBound(var) If var(lngArr, 1) = .Cells(lngRC, 2) & "|" & .Cells(lngRC, 3) Or Len(var(lngArr, 1)) = 0 Then Exit For End If Next lngArr If lngArr < UBound(var) Then var(lngArr, 1) = .Cells(lngRC, 2) & "|" & .Cells(lngRC, 3) var(lngArr, 2) = var(lngArr, 2) & .Cells(lngRC, 1) & "|" End If End If Next lngRC End With 'clear summary, write and sort data With wsSum .Range("A3").CurrentRegion.ClearContents For lngArr = LBound(var) To UBound(var) If var(lngArr, 1) = "" Then Exit For Cells(lngArr + 2, "A").Value = Split(var(lngArr, 1), "|")(0) Cells(lngArr + 2, "B").Value = Split(var(lngArr, 1), "|")(1) varSplit = Split(var(lngArr, 2), "|") For lngRC = LBound(varSplit) To UBound(varSplit) - 1 Cells(lngArr + 2, 3 + lngRC).Value = varSplit(lngRC) Next lngRC Next lngArr .Range("A3").CurrentRegion.Sort _ Key1:=.Range("A3"), Order1:=xlAscending, _ Key2:=.Range("B3"), Order2:=xlAscending, _ Header:=xlNo, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom End With Set wsSum = Nothing Set wsDat = Nothing End Sub
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
With an pivot table.
See the attached file.
Notice my main language is not English.
I appreciate it, if you reply on my solution.
If you are satisfied with the solution, please mark the question solved.
You can add reputation by clicking on the star * add reputation.
Hi HaHoBe, your code is very good.
I'm impressed with your solution.
I will try to understand the code (in the loop), to learn how it was done.
thank you very much!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks