I have a spreadsheet with names in column A, categories in column B, and data for those categories in other columns. If a person has data for multiple categories, their name is listed only once on the top row, and the other rows in column A are blank. For each person there is a bottom row with combined data for all categories - for those rows, column a shows the name followed by "Total" - for example, "John Smith Total".
Column B has the name of a category populated, except for the "total" rows for each person. On those rows, Column B is blank.
Not everybody has data in the same number of categories. Some people have one, most have two, some have three. Right now the maximum number of categories is three.
I want to create a macro that would copy each person's name into the blank rows in column A (so a name would be listed on each row), to make it easier to run sorting/lookup/filtering on the data in this sheet. It's not necessary to remove the word "Total" from any of the rows in column A. It seems like the way to go about this is roughly:
Start with cell A2 (which always has a name)
Move down one cell
If this cell is blank, check to see if the same cell in column B is blank
If the cell in column B is blank, copy the data from the cell above into this one
Move down to the next cell and repeat
I'm only a beginner with VBA, and I'm not sure how to check whether other cells are blank in relation to the selected cell. I'm also not sure how to have the macro figure out when to stop - maybe checking to see if the whole row is blank. Any suggestions you have would be very welcome.
Thanks in advance,