brand_nubian
New Member
- Joined
- Apr 27, 2015
- Messages
- 4
Hi,
I am new and I have searched for a solution to this problem for a few hours. I couldn't find any questions that directly addressed my issue, so here it goes:
I am working on a macro that involves many steps of formatting for one worksheet. Much of that work involves hiding rows and columns. One part of the code, below, works for the most part, in that it attempts to hide the columns I want to hide. The problem is there are many hidden columns (~20 or so) and they aren't completely hidden, just mostly hidden. After my program runs, many of the hidden columns still have a width of 0.58. This leaves the resulting document unbalanced because most of the partially-hidden columns are in one space that I want to have set to a specific width. I have tried adding a line of code to adjust the selected column's width to 0, as you can see below, but that has not resolved the problem. This is just speculation, but one cause I can think of is that in multiple places, I have merged cells across the columns that I intend to hide. What could cause this to happen?
Thanks!
I am new and I have searched for a solution to this problem for a few hours. I couldn't find any questions that directly addressed my issue, so here it goes:
I am working on a macro that involves many steps of formatting for one worksheet. Much of that work involves hiding rows and columns. One part of the code, below, works for the most part, in that it attempts to hide the columns I want to hide. The problem is there are many hidden columns (~20 or so) and they aren't completely hidden, just mostly hidden. After my program runs, many of the hidden columns still have a width of 0.58. This leaves the resulting document unbalanced because most of the partially-hidden columns are in one space that I want to have set to a specific width. I have tried adding a line of code to adjust the selected column's width to 0, as you can see below, but that has not resolved the problem. This is just speculation, but one cause I can think of is that in multiple places, I have merged cells across the columns that I intend to hide. What could cause this to happen?
Thanks!
Code:
Dim c as Range
For each c in Range("Column_Helpers")
If cell.Value = "HIDE" Then
cell.EntireColumn.Hidden = True
cell.EntireColumn.ColumnWidth = 0
End If
Next