I am new to scripting and I am trying to improve my previous code. The code works to change row and height of the cells in regards of the user input. The code is working just fine, except when I input number less than 5 characters inside the text box. It keeps on getting this error : "Run- time error '1004' Unable to set the ColumnWidth property of the Range class". I tried using On Error Resume Next but it didn't works. These are the code:
Dim cm1, pixrow As Double
Dim cm2, pixcol As Double
pixcol = cm1 / 500
pixrow = cm2 / 500
' convert measurement to pixel
pixcol = 0.1409 * pixcol - 0.5771
pixrow = 0.75 * pixrow
Columns.ColumnWidth = pixcol
Rows.RowHeight = pixrow
I kept on getting error in this line "Columns.ColumnWidth = pixcol". Please help.
Thank you.
Bookmarks