PDA

View Full Version : Sort, Page Break and Page Header according to cell values in different worksheet



acsishere
06-16-2008, 11:47 AM
I have a workbook contains sheets named 1) "LIST", 2) "MYDATA"

In LIST sheet, data contains something like this:
ColA / ColB/ ColC
4 / A / QUALITY1
4 / B / QUALITY2
4 / C / QUALITY3
5 / B / QUALITY4
3 / A / QUALITY5 ..... and so on.

In MYDATA sheet, the data contains more than 50-60 columns. A sample is:
ColA TO ColAZ
4 / A / NAME1 / DOB1 / DOA1 / ADDRESS1 /....
(4 / A more than 100 records)
4 / B / NAME101 / DOB101 / DOA101 / ADDRESS101 /....
(4 / B also more than 100 records)
and in a similar way other records (4/C, 5/B, 3/A) are also appear.

Now, I need to sort the data according to first by ColA and then by ColB of MYDATA sheet. Then the pagebreak should also be done according to the same value. (Ex. Just after last row of 3/A, then after last row of 4/A, then after last row of 4/B, then after last row of 4/C, then after last row of 5/B).

When I need to print, concerned page should be like this:
(If I am printing page of 3/A, then) in the header right side: 3/A: QUALITY5 (Vlookup from LIST sheet)
(If I am printing page of 4/A, then) in the header right side: 4/A: QUALITY1 (Vlookup from LIST sheet)
(If I am printing page of 4/B, then) in the header right side: 4/B: QUALITY2 (Vlookup from LIST sheet)

I do agree that this is a little bit tough task, but I hope some wizards will guide me to accomplish this target in no time.

Thanks in advance.

acsishere.

acsishere
06-17-2008, 08:23 AM
Dear Friends,

Any help? As like earlier, I always appreicate your kind help & guidance.

Thanks in advance.

acsishere.

lucas
06-17-2008, 08:33 AM
You have listed a complete and complex project for assistance.....please start breaking your project down into steps and we will help with one step at a time.

If you desire someone to do a complete project for you then click on the Site links at the top of the page and select consulting.

acsishere
06-17-2008, 11:17 AM
I think my explanation is seems to be complexed one.

Now, I attached a file in which I explained the way I required the desired result (Sheet consists of LIST, MYDATA, DESIRED RESULT). I request you to have a look at that.

When I saw a large number of complex codes/macros are written by you, I think this is not at all a problem for you and I hope you will solve it in no time.

As I am novice to VBA, I humbly request your kind help.

Thanks a lot in advance.

acsishere.

acsishere
06-18-2008, 10:56 AM
Please help me to find the solution.

Thanks a lot in advance.

acsishere.

lucas
06-18-2008, 11:15 AM
Please help me to find the solution.


to which problem? This is the first one you list in your original post but you give no criteria??


Now, I need to sort the data according to first by ColA and then by ColB of MYDATA sheet.

acsishere
06-18-2008, 11:54 AM
I have modified my explanation in the post (06-17-2008 11:47 PM) with a attached file (Q2.ZIP).

Thanks a lot in advance.

acsishere.

acsishere
06-19-2008, 11:42 AM
Dear Friends,

Any solution?

lucas
06-19-2008, 12:13 PM
to sort the mydata sheet:
Sub Macro1()
Cells.Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Range("A1").Select
End Sub

acsishere
06-19-2008, 12:48 PM
Thanks for the code to sort.

Thanks a lot.

acsishere.