Ok, I've got the following code in a macro that is supposed to autofit a column up to a certain width. The autofit part works fine, but when it gets a column over the specified limit and tried to reset the width, it chokes. Gives me an error "Could not set ColumnWidth property of range object."
Columns(Col).EntireColumn.AutoFit
If Columns(Col & ":" & Col).Width > 528.75 Then
Columns(Col).ColumnWidth = 528.75
End If
Anyone know why this would be?
Edit: FYI, "Col" is a variable passed to this function, which is simply the column letter as a string.
Columns(Col).EntireColumn.AutoFit
If Columns(Col & ":" & Col).Width > 528.75 Then
Columns(Col).ColumnWidth = 528.75
End If
Anyone know why this would be?
Edit: FYI, "Col" is a variable passed to this function, which is simply the column letter as a string.
Last edited: