Microsoft
Software
Hardware
Network
Question : Excel Width and Height
I have dynamic data coming from an access DB that populates an excel sheet, it refreshes every 15 mins. The data comes in but I have to adjust my rows and columns to a certain measurement.
The code I'm using is:
Private Sub CommandButton1_Click()
Rows("3:70").Select
Selection.RowHeight = 21
Columns("A:F").Select
Selection.ColumnWidth = 20
End Sub
I'm good with the row Ht, I need help on the column width. For example:
Column A =26.29
Column B =13.29
Column C =13.29
Column D =29.14
Column E =41.14
Column F =10.57
I would like the code to reflect those columns stated above.
Answer : Excel Width and Height
Hello SOUTHAMERICA70,
You could simply replace
Columns("A:F").Select
Selection.ColumnWidth = 20
with
[a:a].ColumnWidth = 26.29
[b:b].ColumnWidth = 13.29
'etc
You could also just autofit the range:
Columns("A:F").AutoFit
Regards,
Patrick
Random Solutions
How to run an executable packaged inside a JAR?
Install MS Visual Studio .NET/SQL Server and PHP/MySql on the same computer
ActiveX Combo Box
Command Button Help!!
How to get a formula to calcutate even if one of the fields in it is null
How to add images and change backcolor when select on tabpage header+vb.net 2005
How do I add a domain address to my Exchange 2007 mail server?
I have a folder that will have lots of files in them i want to backup *.bak and *.txt files into a zip file using winzip and then name the zip ETC-DD-MM-YYY
How to create a bootable USB drive for Windows installation
how to see Public folder in address book window