Hi I am having some difficulty creating a macro - i need a macro whereby when the user input a dept code, the macro will take the number, go to first worksheet, read column B until it match the dept code, then copy all the appropriate rows for the dept code. I then need this to loop until the last worksheet. The workbook has about 9 worksheets.
A:
does it really need to be VBA?
you could actually do this with the VLOOKUP-function.
you may pass your search criteria 'c'
, a table 'T'
and a column index 'i'
.
it will return you the content of the column 'i'
in 'T'
where column 1 matches your criteria 'c'
.
or am i misunderstanding your question?
regards
Atmocreations
2009-09-10 23:02:48
A:
tried that - basically, once the dept codes are matched, i am not returning a value, but an array range. For example, value in input in A1 (Sheet 1), then use the input to match all the values column A (A1:A99)in Sheet2. If there's a match, copy the heading rows and all other rows (A:ZZ)associated to the input value in an array format.