need macro to filter data from multiple sheets in a worksheet

K

Khawajaanwar

In sheet 1 I have about 15,000 rows in the following columns
A1(Unique id)
A2 Names of persons
A3 Address
A4 Amount for the year 2005
A5 Amount for the year 2006
A6 Amount for the year 2007 (Blank / no date)

In sheet 2 i have 22,500 rows and have following columns
A1 (Unique id)
A2 Names of person
A3 Address
A4 Amount for the year 2007

Same above column in sheet 3, sheet 4 and sheet 5
I have to update the rows of column A6 of sheet 1 through column A4 of sheet
2, sheet 3, sheet 4 and sheet 5

Please help to filter the data
 
K

Khawajaanwar

Hi Guys,
Please help to sort the qurey. I need this macro or forumula to sort the data.
 
J

JLatham

If you are still in need of assistance with this, contact me via email at
(remove spaces)
HelpFrom @ JLatham Site. com
with a copy of your workbook attached and explain again what you require.
 
A

Amit Kumar

i don't know if you can help but i have been given the task of
creating a macro forthis question.

Create a workbook having a button. When the user presses the button,
it should sort the data in sheet1 & then add subtotals to it. The
parameters required for sorting & subtotals are specified in the
sheet2.

if you can help it would be so nice of you . please if you or anyone
else can solve it by monday please send it to my id alongwith the
excel file



any help would be great
 
J

Jef Gorbach

Sounds easy enough. Assuming your data is something like:

(col a) (col b)
Header1 values
a 73
b 84
c 31
a 14
b 24
b 88
c 46
c 89
b 22
d 67
d 48
c 75
d 67
a 64
d 92

then this:

Sub test()
Cells.Sort _
key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Cells.Subtotal _
GroupBy:=1, _
Function:=xlSum, _
TotalList:=Array(2), _
Replace:=True, _
PageBreaks:=False, _
SummaryBelowData:=True
End Sub

would produce:

Header1 header2
a 73
a 14
a 64
a Total 151
b 84
b 24
b 88
b 22
b Total 218
c 31
c 46
c 89
c 75
c Total 241
d 67
d 48
d 67
d 92
d Total 274

Grand Total 884
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top