Macros that recognize if cells have moved?


Posted by David on December 21, 2001 5:50 AM

I have to format reports every day. Highlight totals lines, etc. The only problem is that the reports can be different every time. The totals lines are not always in teh same place. Can someone head me in the right direction to writing macros that find the lines I am looking for and then make the changes. Does this require writing the macros in the VB editor?



Posted by Mark O'Brien on December 21, 2001 8:02 AM

It depends how different the reports are.

If the only difference is the number of rows in the report (i.e. the column headers are the same) then it would be reasonably simple to write a macro that will highlight the cells for you.

The way to do it in a macro would be to search for text that is beside the totals e.g. there may be a cell that has the word "Total" in it. Then once you've got that cell, you would apply your highlighting format to the cells that contain the totals beside it.

If you post an example row of a totals line, I should be able to do it.

To get the VBA code for the formatting, simply record a macro of what you manually do right now.

HTH