Question:
MS Excel: whats are your top 5 most useful macros?
2008-11-07 14:31:25 UTC
be it in a work environment, students, academics etc.
what macros makes your life easier, and plz could you also provide the VBA code as well, THANKS
Three answers:
expletive_xom
2008-11-10 18:35:23 UTC
most of them are simple recordable ones...



i click this a lot(without even thinking about it). it un-merges merged cells, and centers accross selection. i really really hate merged cells



Sub CenterAcrossColumns()

' CenterAcrossColumns Macro

' Macro recorded 5/6/2007 by



With Selection

.HorizontalAlignment = xlCenterAcrossSelection

.MergeCells = False

End With



End Sub



other useful ones that i saved to buttons are

- footer- file&pathname

- Convert Case -upper/lower/sentance/Title

- automatic pivot table refresh (thats not a button...it just refreshes the table when i click the sheet tab)

- File Save- pulls from cell to name the file, and saves it in my directory of choice...heres a basic one uses text in cell A1 as filename



Sub FileSaveAone()

Dim Path As String

Dim FilNam As String

Path = "C:\work\"

FilNam = Range("A1")

ActiveWorkbook.saveas FileName:=Path & FilNam & ".xls", FileFormat:=xlNormal

End Sub



several others
reyna
2016-05-26 11:53:44 UTC
macros are used as sort of a copy-paste thing. You can create a long formula once in a macros and "paste" it in a cell. usually the A cell will have the #s you are working with the B cell you paste the formula in and C cell will contain the answer. in Word the macro is used the same way but with words..example if you were a legal sec. and had to type up a will you might have certain parts that are "standard" legal jargon often called "boilerplate". You could type it into a macros and # them, so when you come to the place that "standard" law or whatever has to be placed you just hit the macros # and the whole thing is placed there for you. you can create many different macros and give them a # so you can retreive which ever one fits your needs. Sorry I cant go into more detail as I havent done it in years..its nice to be retired!
Michael E
2008-11-07 15:22:36 UTC
This toggles the column widths between 5 and Autofit. I'm always pushing that (custom) button.



Sub ToggleColumnWidths()

With ActiveSheet



If .Columns.ColumnWidth = 5 Then

.Columns.AutoFit

Else

.Columns.ColumnWidth = 5

End If



End With

End Sub


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...