Auto Fill Macro Hi, Sometime while inserting text within an sheet that headings
ID: 3560927 • Letter: A
Question
Auto Fill Macro
Hi,
Sometime while inserting text within an sheet that headings are hidden and also the sheet is protected in some places, the problem is when the text value anything related is inserted manually within the cells it does not fit within the cell, so the text will be not all visible and as number # this appears. How could there me a macro that can run or within the whole workbook or just only within one sheet, that if a text or value is greater than the cell size the macro will automatically auto fill the cells so that any text will be visible.
Thanks
Explanation / Answer
(If you want to achieve this result without manual intervention, see if the following satisfactorily meets your needs:;
In the workbook's ThisWorkbook module paste the following event code:
'==========>>
Option Explicit
'---------->>
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim Rng As Range, rCol As Range
Set Sh = ActiveSheet
Set Rng = Intersect(Target, Sh.UsedRange)
On Error GoTo XIT
Application.ScreenUpdating = False
For Each rCol In Rng.Columns
rCol.EntireColumn.AutoFit
Next rCol
XIT:
Application.ScreenUpdating = True
End Sub
'<<==========
===@@
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.