Skip to main content

autofit rows and column in excel vba

Everytime we copy the data  and paste in new sheet , it get unfit . Some data unvisible and Column are not unfit .we require to column auto resize 

method 1


press  CTRL + A
 then press Alt then button H then button O then button I

it easy but if you have many sheet

method 2


copy it on module


Sub autofit () 
Rows. Entirerow. Autofit
Columns. Entirecolumn. Autofit
 End sub

Comments

  1. This is so helpful. Thnku so much. Keep doing this.

    ReplyDelete

Post a Comment

Popular posts from this blog

GSTR 1 CDNR sheet Editing

You spent lots of time in structuring the CDNR sheet for future working. It easy for 1 time, took more time if you have 2 sheets but if you have more than 5 sheets then this trick helps you in time-saving and from machine work. It simple and easy  Here are the steps : Press ALT +F11 insert new module copy the code and paste in module Sub vir() Application.ScreenUpdating =false     Rows("1:4").Select     Range("O1").Activate     Selection.Delete Shift:=xlUp     ActiveSheet.Shapes.Range(Array("Picture 1")).Select     Selection.Delete     Range("C1:F1").Select     Selection.ClearContents     Range("J1:M1").Select     Selection.ClearContents     Range("A1:A2").Select     With Selection         .HorizontalAlignment = xlGeneral         .VerticalAlignment = xlCenter         .WrapText = True         .Or...

Excel Shortcut Keys

Everyone wants speed in every work, to get speed in excel you used shortcuts for different operations, which is very useful in saving time ,you become a speeder in excel ,that save lots of time Close a workbook Ctrl+W Open a workbook Ctrl+O Go to the  Home  tab Alt+H Save a workbook Ctrl+S Copy Ctrl+C Paste Ctrl+V Undo Ctrl+Z Remove cell contents Delete Choose a fill color Alt+H, H Cut Ctrl+X Go to  Insert  tab Alt+N Bold Ctrl+B Center align cell contents Alt+H, A, C Go to  Page Layout  tab Alt+P Go to  Data  tab Alt+A Go to  View  tab Alt+W Open context menu Shift+F10, o...