Excel VBA

Excel VBA Macro Adds IfError() Functions To Every Formula

Today I found some useful code I wanted to share with our readers. A macro to automatically add an IfError() function to every formula on every sheet in a selected workbook, assuming there was not already an IfError function used. Remember that macros have no Undo command. Once you run this VBA macro the only undo is to close […]

Read More
VBA Macros for Conditional Formatting

VBA Macros for Conditional Formatting

VBA Macro for Conditional Formatting Private Sub Worksheet_Change (ByVal Target As Range) Set MyPlage = Range(“C3:I11,C13:I34”) For Each Cell in MyPlage If Cell.Value Like “A*” Then Cell.Interior.ColorIndex = 38 ElseIf Cell.Value Like “B*” Then Cell.Interior.ColorIndex = 35 ElseIf Cell.Value Like “C*” Then Cell.Interior.ColorIndex = 34 ElseIf Cell.Value Like “D*” Then Cell.Interior.ColorIndex = 40 Else Cell.Interior.ColorIndex […]

Read More
Learn to Plot A "XYScatter Chart" on Fly : VBA Macro Code

Learn to Plot A “XYScatter Chart” on Fly : VBA Macro Code

VBA Macro Code to Plot A “XYScatter Chart” on Fly Sub chartData() On Error Goto ErrHandler Dim xRow As Long Dim wsName As String Dim ws As Worksheet Set ws = ActiveSheet wsName = ws.Name xRow = Cells(Rows.Count, “A”).End(xlUp).Row ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlXYScatterSmooth ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = “='” & wsName & “‘!$A$17” ActiveChart.SeriesCollection(1).XValues = “='” & […]

Read More