tags:

views:

171

answers:

2

I know there must exist Excel Macros that can automatically fill in the values of empty cells in a table given the values in the header row and column as well as other configuration parameters in other cells. Of course, these macros will usually be tied to a particular set of attributes, ect. Does there exist any generic macro for this which can easily be adapted based on the situation?

  • Note: I don't actually need such a Macro, I'm simply trying to see if one exists for the purpose of comparison.
A: 

Pretty vague. There are add-ins that exist that fill sample data automatically. I could Google it, but it's hard to tell by your question what you are looking for exactly.

guitarthrower
A: 

So you're looking for a macro that sets a cell's value based on it's formatting if it finds the cell to be empty? I'm not sure that there's a sample out there that's going to be exactly what you're looking for, but it sounds like a simple enough thing to make that finding something to compare it with won't yield much different results.

"For each of the cells, replace the empty cell with a value based on the cell's formatting."

1) a 'For Each' loop referencing the cell range

2) an IF statement 'If cellRef.value = vbEmpty then cellRef.value = '

3) just use multiple IF statements or a SWITCH case to determine the proper value to be put in the cell

My logic isn't chronologically correct, but you get the idea.

JakeTheSnake
This question isn't about formatting, but formatting could be a useful way of marking what is a column name
Casebash
I supposed I used the word "formatting" in a vague way that clashes - but I meant "everything that has to do with a cell's configuration". I'm guessing the question you posed is primarily about making your code more efficient? I suppose one way you could do that is to hard-code in a default value for a given column and do a simple check on the current range to see what that value should be. Other than that, I don't know where to find such a macro and without viewing your code, there's not much more I can tell you.
JakeTheSnake
Actually, one of the artefacts produced for my honors thesis was a generic table generator and I needed to compare it to what already existed. Finished now, so isn't that important
Casebash