thanks Dale Watson again, ur file is really helpful.
but i have another problem and this's kind of weird for me.
Sub Extract()
dim r2 as Integer
r2 = 200
Application.ScreenUpdating = False
worksheet("sht1"
.Range("E2:E"& r2).AdvancedFilter
Action:=xlFilterCopy, _
CopyToRange:=worksheet("sht2"
.Range("A2:A10"
, _
Unique:=True
Application.ScreenUpdating = True
End Sub
if i use worksheet buttom to run this macro, it works perfectly, copy all unique item from range in worksheet 'sht' to range in worksehet 'sht2'. but if i call this macro from the other macro and pass the value r2 which is 200 from that macro to this 'Extract' macro, it won't work, the code is:
Sub Extract(r2 as integer)
Application.ScreenUpdating = False
worksheet("sht1"
.Range("E2:E"& r2).AdvancedFilter
Action:=xlFilterCopy, _
CopyToRange:=worksheet("sht2"
.Range("A2:A10"
, _
Unique:=True
Application.ScreenUpdating = True
End Sub
it will produce nothing, and there's no error message. why?
thank u for any help!
but i have another problem and this's kind of weird for me.
Sub Extract()
dim r2 as Integer
r2 = 200
Application.ScreenUpdating = False
worksheet("sht1"
Action:=xlFilterCopy, _
CopyToRange:=worksheet("sht2"
Unique:=True
Application.ScreenUpdating = True
End Sub
if i use worksheet buttom to run this macro, it works perfectly, copy all unique item from range in worksheet 'sht' to range in worksehet 'sht2'. but if i call this macro from the other macro and pass the value r2 which is 200 from that macro to this 'Extract' macro, it won't work, the code is:
Sub Extract(r2 as integer)
Application.ScreenUpdating = False
worksheet("sht1"
Action:=xlFilterCopy, _
CopyToRange:=worksheet("sht2"
Unique:=True
Application.ScreenUpdating = True
End Sub
it will produce nothing, and there's no error message. why?
thank u for any help!