MWE
03-17-2014, 04:20 PM
I am running xl2003 and WinXP. I have written tons of VBA code for xl and most other Office programs. I recently encountered a problem hiding columns under VBA control. Consider a spreadsheet with two rows of header information. Row 1 contains high level categories, row 2 contains specific headings within each category. The cells in Row 1 for a given category are merged. Assume that Category A is cols 1 through 5 so cells (1,1) to (1,5) are merged.
Under manual control, you can hide/unhide any of the cols in category A and you get what you expect, e.g., if you select col 2 and right click to hide it, col 2 is hidden while cols 1, 3, 4 and 5 remain visible. However, if you do that with VBA code, all the cols in the category with merged cells in row 1 are hidden. In the simple case, if you use VBA to hide col 2, cols 1 through 5 are hidden.
Anyone know what this happens?
Under manual control, you can hide/unhide any of the cols in category A and you get what you expect, e.g., if you select col 2 and right click to hide it, col 2 is hidden while cols 1, 3, 4 and 5 remain visible. However, if you do that with VBA code, all the cols in the category with merged cells in row 1 are hidden. In the simple case, if you use VBA to hide col 2, cols 1 through 5 are hidden.
Anyone know what this happens?