By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

Become an Σxpert at Σxcel.com

 


Standard VBA/Excel (70 of 1182)

(Clear Filter = *record*)

A01 Dim rsCOB As DAO.Recordset
Activecell.formulaR1C1 = .... - code from macro recorder
ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=1 ' recorded
Activesheet.PivotTables("PivotTable11").PivotFields("CtryOfDom").PivotItems ' recorded
ActiveSheet.PivotTables("PivotTable3").ChangePivotCache ... ' recorded
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh ' recorded
ActiveSheet.PivotTables("PivotTable3").PivotFields("Region").ClearAllFields 'recorded
ActiveSheet.PivotTables("pt1").ColumnGrand = True ' recorded
ActiveSheet.PivotTables("pt1").PivotFields("Acct_nbr").Autosort xldescending, sort ' recorded
ActiveSheet.PivotTables("pt1").PivotFields("coper_id").PivotFilters.Add Type:=xlTopCount, DataFiled:=... ' recorded
ActiveWindow.SelectedSheets.Delete - recorded to delete multiple sheets (displayalerts=false) to turn off warning
ActiveWorkbook.Worksheets("....").Autofilter.sort.sortfileds.clear ' clears a filters sorting ' recorded
Application.Autocorrect ' record
Application.CalculateFull ' recorded
Application.Calculation = xlCalculationManual ' recorded
Application.ErrorCheckingOptions.BackgroundChecking = False ' recorded optimize
Application.WindowState = xlMaximized - recorded
Application.WindowState = xlNormal - recorded
Applicaton.WindowState = xlMaxmized ' recorded
As DAO.Recordset
Borders - Record the code
Columns("A:A").ColumnWidth = 7.43 - recorded
DeleteExternalNames - deletes named ranges starting with External_ ' recorded
Dim rs as New ADODB.Recordset
Finding the Macro being Recorded
Formatcols - Format the excel while recording
formatting routines - almost all are recorded and modified
FormatXyz - udf - to format data usually via recorded code,
GetRecodset (sSQL, Optional maxRecords) as ADODB.Recordset '
Insert a column - Columns(lCol).EntireColumn.Insert ' recorded
Learn by using the Macro recorder
Learn via Macro recorder
Macro recorder hardcode removal
OpenRecordset
Protecting a Sheet
range(...).Autofilter Field:=1, criteria1:="=" & sValue, Operator:=xlAnd = recorded sets a filter
Range(selection, selection.End(xlDown)).Select - select area - recorded
Recording a Macro and Generalizing it
Rows("1:1").RowHeight = 52.5 ' recorded
RunQuery( ) - udf db - runs a query that returns 1 value and not a recordset
s,Selection.NumberFormat = "_(* #,##0_);_(* (#,##0);_(* ::-""??_);_(@_)" 'recorded (g)
Select a column - Columns(i).select
Selection.Autofill destination:=Range("H2:I" & r)
Selection.autofilter = turns off filter
Selection.Characters.Text = "Add TOC" ' after selecting a button, you can change the text
Selection.Copy - copies the active selection to the clipboard
Selection.copy
Selection.CurrentRegion.Select
Selection.cut - Clipboard
Selection.Delete Shift:=xlUp ' recorded
Selection.End(xlUp).select ' recorded
Selection.EntireColumn.Hidden = True ' recorded
Selection.Font.Underline = xlUnderlinestyleSingle
Selection.Insert Shift:=xlToRight - recorded
Selection.Merge
Selection.Numberformat = "#,##0.0,,,"
Selection.NumberFormat = "m/d/yyyy"
Selection.NumberFormat = "mmm-yy"
Selection.OnAction = "TOC1.AddTocSheet" ' Select the shape first via ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.PasteSpecial ... ' recorded
selection.PasteSpecial Paste:=xlPasteColumnWidths, ..' recorded
Selection.Pastespecial Paste:=xlPasteValues... 'recorded
Selection.Replace what:="#N/A", Replacement:="0", LookAt... 'Recorded
Selection.WrapText = False ' recorded
Seletction.Style = "Percent" ' recorded
Sheets("name").select - selects a sheet
Sheets(2).visible = True
VLookup with RC[-44] from recorded code
WebQuery - internet - udf - run a url and loads the output to a worksheet - recorded
What you can record and what you can't (loops, decisions, flexibility)