LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Excel-Macro Problem

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Problem In Excel Due to Macro? [email protected] Excel Discussion (Misc queries) 4 March 20th 07 04:05 PM
Macro problem in Excel pd Excel Discussion (Misc queries) 2 March 14th 06 05:49 AM
problem with macro on Excel Captain Picard Excel Worksheet Functions 0 February 1st 06 09:20 PM
problem with import files by excel macro Raven Excel Discussion (Misc queries) 0 January 20th 06 08:23 AM
Urgent Help Required on Excel Macro Problem Sachin Shah Excel Discussion (Misc queries) 1 August 17th 05 06:26 AM


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"