I have two data ranges:
DataRange is the range in Sheet1 (something like A16:F30)
HoursDataRange is the range in Sheet2 (something like A17: G90).
I need to loop via DataRange
rows, take values from row, do some manipluation (like adding those data into seeprate wrokbook), as well, as take corresponding cell in column A and find all rows in Sheet2
(HoursDataRange
). I do not know how to do the last thing - find all matching rows in Sheet2.
I am not familiar with VBA yet, so I have read that I can use AutoFilters
to filter HoursDataRange
or lookups or loops.
What is the best solution?
As I am programmer, I do understand loops, but I am not so familar with VBA.
Here is a shortenedn example of Sheet1:
NAV Nr. CompName VAT Nr. Adress Name Type
101 Int1 1 Address1 Au 1
103 Int2 2 Address2 De 1
210 Int3 3 Address3 Es 1
212 Int4 4 Address4 Sw 1
310 Int5 5 Address5 Fi 1
345 Int6 6 Address6 Fr 1
And here is shortened example of Sheet2:
Key Acc Key NAV Nr. Client EUR
3 Bu STA BU 212 Cl1 25,00
4 Bc STA BC 101 Cl2 25,00
1 Bu STA BU 212 Cl1 25,00
2 Bc STA BC 101 Cl2 25,00
So, you see the column Nav Nr.
is in both sheets and there are matching values. We can assume that each Nav Nr
. occures only once in Sheet1
and I am already looping via Sheet1 DataRange. However, in Sheet2
given Nav Nr
can appear from 0 to N times. So I need to find all matching rows (I need to find the whole row and not just cell, because I need manipulations for the all values in rows, for example, Later I would have to sum up EUR column by Nav Nr.
and create PDF, but this woudl be later staff. FOr now I just want to know how to find those matching rows.