![]() |
How to create a macro
Hi,
I wanna create a macro in excel to format my sheet when ever i pull it from our company's software. That sheet changes from time to time ex: no of columns & rows.. not same everytime. But that report is not so perfect.. I wanna run a macro to format that sheet so that I can save the time. When I pull that sheet it consists of merged cells, then I've to remove merged cells, I've to center align them and I've to autofit them.... so that its completed.. Can any one suggest me doing this. Thanks in advance... |
How to create a macro
Try recording a macro when you do the formatting manually.
Srikanth wrote: Hi, I wanna create a macro in excel to format my sheet when ever i pull it from our company's software. That sheet changes from time to time ex: no of columns & rows.. not same everytime. But that report is not so perfect.. I wanna run a macro to format that sheet so that I can save the time. When I pull that sheet it consists of merged cells, then I've to remove merged cells, I've to center align them and I've to autofit them.... so that its completed.. Can any one suggest me doing this. Thanks in advance... -- Dave Peterson |
How to create a macro
Hi,
I tried with a macro doing manually..... But it deletes tha same columns as it did in the first sheet. "Dave Peterson" wrote: Try recording a macro when you do the formatting manually. Srikanth wrote: Hi, I wanna create a macro in excel to format my sheet when ever i pull it from our company's software. That sheet changes from time to time ex: no of columns & rows.. not same everytime. But that report is not so perfect.. I wanna run a macro to format that sheet so that I can save the time. When I pull that sheet it consists of merged cells, then I've to remove merged cells, I've to center align them and I've to autofit them.... so that its completed.. Can any one suggest me doing this. Thanks in advance... -- Dave Peterson |
How to create a macro
So how do you know which columns to work on within each sheet?
And can you post the code that you have? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Srikanth" wrote in message ... Hi, I tried with a macro doing manually..... But it deletes tha same columns as it did in the first sheet. "Dave Peterson" wrote: Try recording a macro when you do the formatting manually. Srikanth wrote: Hi, I wanna create a macro in excel to format my sheet when ever i pull it from our company's software. That sheet changes from time to time ex: no of columns & rows.. not same everytime. But that report is not so perfect.. I wanna run a macro to format that sheet so that I can save the time. When I pull that sheet it consists of merged cells, then I've to remove merged cells, I've to center align them and I've to autofit them.... so that its completed.. Can any one suggest me doing this. Thanks in advance... -- Dave Peterson |
How to create a macro
Hi Bob,
Below is the code.. Sub bo() Columns("A:A").Select Selection.Delete Shift:=xlToLeft Rows("1:3").Select Selection.Delete Shift:=xlUp Cells.Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Rows.AutoFit Columns("C:C").Select Selection.Delete Shift:=xlToLeft Columns("G:G").Select Selection.Delete Shift:=xlToLeft Columns("F:F").ColumnWidth = 18.86 ActiveWindow.SmallScroll Down:=-30 Rows("1:1").Select Selection.AutoFilter Columns("J:N").Select Selection.Delete Shift:=xlToLeft ActiveWindow.SmallScroll Down:=12 Range("F14").Select ActiveCell.SpecialCells(xlLastCell).Select Rows("724:727").RowHeight = 0 Rows("723:723").RowHeight = 1.5 Range("A722:A733").Select Range("A733").Activate Selection.Delete Shift:=xlToLeft Rows("722:730").Select Selection.Delete Shift:=xlUp Range("C722").Select ActiveWindow.SmallScroll Down:=-6 Range("B2").Select ActiveWindow.SmallScroll Down:=378 ActiveWorkbook.Save End Sub Please let me know the solution.. Thanks in Advance "Bob Phillips" wrote: So how do you know which columns to work on within each sheet? And can you post the code that you have? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Srikanth" wrote in message ... Hi, I tried with a macro doing manually..... But it deletes tha same columns as it did in the first sheet. "Dave Peterson" wrote: Try recording a macro when you do the formatting manually. Srikanth wrote: Hi, I wanna create a macro in excel to format my sheet when ever i pull it from our company's software. That sheet changes from time to time ex: no of columns & rows.. not same everytime. But that report is not so perfect.. I wanna run a macro to format that sheet so that I can save the time. When I pull that sheet it consists of merged cells, then I've to remove merged cells, I've to center align them and I've to autofit them.... so that its completed.. Can any one suggest me doing this. Thanks in advance... -- Dave Peterson |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com