brorick
03-31-2008, 06:51 AM
I was wondering if there is a way to copy a row number when using this line of code. I have a need to reference the row number and therefore would like to include it when the data is copied to the specific cells. Any help would be greatly appreciated. :help
A B
1 Dept EmpName
2 HR Rob
3 Acct Chrissy
4 Security Larry
If I filtered for Acct and copied the row as in the code below I would hope to include the rownumber.
Based on the code below
Z1 = Dept
Z2 = Acct
AA1 = 3 'This would be the row number
AB1 = Acct
AC1 = Chrissy
Dim rng as Range
Set rng = Range("database")
rng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"Z1:Z2"), CopyToRange:=Range("AA1:AC1"), Unique:=False
Thank you in advance.
A B
1 Dept EmpName
2 HR Rob
3 Acct Chrissy
4 Security Larry
If I filtered for Acct and copied the row as in the code below I would hope to include the rownumber.
Based on the code below
Z1 = Dept
Z2 = Acct
AA1 = 3 'This would be the row number
AB1 = Acct
AC1 = Chrissy
Dim rng as Range
Set rng = Range("database")
rng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"Z1:Z2"), CopyToRange:=Range("AA1:AC1"), Unique:=False
Thank you in advance.