A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
May I know any details why it doesn't worked on your side?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I have a spreadsheet with lots of columns that only need displayed if something is wrong. I Have not been able to find a way to set a selection of columns width programicaly, or to hide/unhide them Please help!
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
May I know any details why it doesn't worked on your side?
Hi Jeffrey, hope you're doing well. I’m Ian, and I’m happy to help you today.
You can do this via VBA Macro. Please sample code below. You can change the column and width of it.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
If IsEmpty(Range("A1").Value) Then
Columns("B").ColumnWidth = 5
Else
Columns("B").ColumnWidth = 10
End If
End If
End Sub
This is a user-to-user support forum and I am a fellow user.
I hope this helps, but please let me know if you need anything else.