lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I want to change a cell width in vba. So I wrote the code below. I also went to option-->advance-->display-->ruler and change the unit to centimeters. I selected cell A1 and then went to home-->format-->cell width and it gave me 8.35.
My questions:
1) why excel did not show measurement unit when I went to home-->format-->cell width
2) when I change the width in my vba code to 20, what does 20 means here? cm or what? how can I make sure it is change to 20 cm in vba? Thank you
fyi chaning cell width/measurement unit article below
https://support.office.com/en-us/ar...w-height-72f5e3cc-994d-43e8-ae58-9774a0905f46
I want to change a cell width in vba. So I wrote the code below. I also went to option-->advance-->display-->ruler and change the unit to centimeters. I selected cell A1 and then went to home-->format-->cell width and it gave me 8.35.
My questions:
1) why excel did not show measurement unit when I went to home-->format-->cell width
2) when I change the width in my vba code to 20, what does 20 means here? cm or what? how can I make sure it is change to 20 cm in vba? Thank you
Code:
Sub col()
ThisWorkbook.ActiveSheet.Columns(1).ColumnWidth = 20
End Sub
fyi chaning cell width/measurement unit article below
https://support.office.com/en-us/ar...w-height-72f5e3cc-994d-43e8-ae58-9774a0905f46