How to prevent the auto resizing of a column (ie, lock the width)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Interested in keeping the colmns from resizing as it does automatically when
data entered overflows the current set width. Spreadsheet is being used by
partially disabled (parkinsons disease) individual - mistakes include holding
down number key too long throwing it into repeating mode. She hits <enter>
key rather than <esc> key and, wa-la, the column expands. Deleting the entry
does not restore the width and so the spread becomes difficult to work with.
 
A code like this will keep the column width, each time you activate the
sheet with the code , this code would go into the worksheet module, try
copying this code the go to excel and right click on sheet1 tab, view
codes, paste this code,
exit from VBA and go to sheet two, then go back to sheet one and and
the columns should have there set widths

Private Sub Worksheet_Activate()
Columns("E:E").ColumnWidth = 12
Columns("G:G").ColumnWidth = 12

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top