I know there are ways that I can manually autosize the column width (select all and then click on any column end, format> autosize etc) but i want to autosize the column width based on the data that i paste.
Asked
Active
Viewed 172 times
1 Answers
0
I believe your question has been answered HERE
TLDR;
Columns("A:B").Select
Selection.EntireColumn.AutoFit
and use the Worksheet_Change
event

Jax297
- 617
- 1
- 6
- 8
-
If i use the below VB code it will then work as a charm but I will have the file to be stored in .dotm format correct? – Rushabh Shah Jun 11 '19 at 12:41
-
Private Sub Worksheet_Change(ByVal Target as Range) Columns("A:B").Select Selection.EntireColumn.AutoFit End Sub – Rushabh Shah Jun 11 '19 at 12:42
-
You can remove macro on last save – Jax297 Jun 12 '19 at 13:56
-
any other way to do this? I might have to autosize multiple times by different people. – Rushabh Shah Jun 12 '19 at 21:33