S3RG3
07-04-2017, 11:00 PM
Hi Everyone,
I am new to the forum - beginner to intermediate level VBA user and advanced Excel user - looking forward to helping and being helped on this forum =)
My first question is this - I am trying to use AdvancedFilter function to parse a range of cells from one sheet into another (via VBA), however, I need to exclude the title of the input range from my results...
VB:
Worksheets("Worksheet1").Range("J2" & ":J" & LastrowJ).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets("Worksheet2").Range("D18:D19"), CopyToRange:=Worksheets("Worksheet3").Range("A" & Lastrowa), Unique:=True
Appendix: J2 is the header/title of my input range and LastrowJ is the value of the last cell; D18 : D19 contains filtering criteria; Lastrowa is the value of the first cell to where my data is copied/filtered through.
I could simply refer my input range to start one cell AFTER the title, however, that will disallow my CriteriaRange to be applied correctly during filtering (e.g. CriteriaRange contains information on the column header used for filtering).
Alternatively, I could point my criteria to the first cell in the input range, instead of the title, but that is least desirable...
If anyone has any ideas/suggestions - please share - I will be very much obliged!
I am new to the forum - beginner to intermediate level VBA user and advanced Excel user - looking forward to helping and being helped on this forum =)
My first question is this - I am trying to use AdvancedFilter function to parse a range of cells from one sheet into another (via VBA), however, I need to exclude the title of the input range from my results...
VB:
Worksheets("Worksheet1").Range("J2" & ":J" & LastrowJ).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets("Worksheet2").Range("D18:D19"), CopyToRange:=Worksheets("Worksheet3").Range("A" & Lastrowa), Unique:=True
Appendix: J2 is the header/title of my input range and LastrowJ is the value of the last cell; D18 : D19 contains filtering criteria; Lastrowa is the value of the first cell to where my data is copied/filtered through.
I could simply refer my input range to start one cell AFTER the title, however, that will disallow my CriteriaRange to be applied correctly during filtering (e.g. CriteriaRange contains information on the column header used for filtering).
Alternatively, I could point my criteria to the first cell in the input range, instead of the title, but that is least desirable...
If anyone has any ideas/suggestions - please share - I will be very much obliged!