Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub test_caller()
Call Par_test(2, 24) End Sub Sub Par_test(startr_sh1, startr_sh2) Worksheets("Sheet1").Range("B1").Value = "reqslist" Worksheets("Sheet2").Range("B1").Value = "reqslist" lastr_sh1 = Worksheets("Sheet1").Range("B" & startr_sh1 & ":B" & Rows.Count).End(xlDown).Row lastr_sh2 = Worksheets("Sheet2").Range("B" & startr_sh2 & ":B" & Rows.Count).End(xlDown).Row Worksheets("Sheet1").Range("B" & startr_sh1 & ":B" & lastr_sh1).Copy _ Destination:=Worksheets("Sheet3").Range("A2") Worksheets("Sheet2").Range("B" & startr_sh2 & ":B" & lastr_sh2).Copy _ Destination:=Worksheets("Sheet3").Range("A" & lastr_sh1 + 1) Worksheets("Sheet3").Select Range("A1").Value = "reqslist" 'column A must have a header to make "AdvancedFilter Action:=xlFilterInPlace, Unique:=True" work well! lastr_sh3 = Worksheets("Sheet3").Columns("A:A").End(xlDown).Ro w Columns("A:A").Select Range("A1:A" & lastr_sh3).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Selection.CurrentRegion.Select Selection.Copy Range("B1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ActiveSheet.ShowAllData Columns("A").Delete lastr_sh3 = Worksheets("Sheet3").Columns("A:A").End(xlDown).Ro w Range("B2").Formula = "=SUMIF(Sheet1!$B:$B,$A2,Sheet1!$L:$L)" Range("C2").Formula = "=SUMIF(Sheet2!$B:$B,$A2,Sheet2!$L:$L)" Range("B2:C2").AutoFill Destination:=Range("B2:C" & lastr_sh3), Type:=xlFillDefault End Sub Regards, Stefi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Printing Problem In Excel Due to Macro? | Excel Discussion (Misc queries) | |||
Macro problem in Excel | Excel Discussion (Misc queries) | |||
problem with macro on Excel | Excel Worksheet Functions | |||
problem with import files by excel macro | Excel Discussion (Misc queries) | |||
Urgent Help Required on Excel Macro Problem | Excel Discussion (Misc queries) |