Link to home
Create AccountLog in
Avatar of DCUnited
DCUnitedFlag for United States of America

asked on

Excel macro to autofill data in column based on adjoining column and continue for each value in column

It's been forever since I developed anything in VB. I'm looking to do a macro that will take the first value in column A (after the header) and autofill down based on column B. This would need to continue down to the end of data. Column A is a list of names and columns to the right is the data. The first name in column A could run from A3:A12 but the name would only show in A3. I need to autofill the name in A3 down to A12 and then continue to the next name in A14 & autofill name to A19 and so on. The number of rows for each name can change daily.
I included an example: Columns A:C is the data & F:H is how it want it to look.
EE-Autofill.xls
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Easily done without VBA as well.

Select the data as a whole and apply AutoFilter. Select the filter for column B and deselect the "(blanks)" option; you may have to collapse the date groupings to see that option. Then select the filter for column A and deselect everything but the "(blanks)" option. The list will now show those rows where blank on column A and not blank in column B. In the first cell of column A enter a formula:

=A3  assuming first visible row is row 4

Hover over the bottom right corner of this cell and cursor will change to a bold + symbol, click and drag down for the extent of the data.

Disable the AutoFilter and the rows will now be populated. If necessary, copy and paste as values.

Thanks
Rob
Avatar of DCUnited

ASKER

Worked like a charm