Sub CreateDataBars()
    Dim strActiveWSName As String
    Dim intlastSheetNr As Integer
    Dim intSheetCounter As Integer
    Dim strWsName As String
    Dim bDoSomething As Boolean
    Dim intIndex As Long
    
    strActiveWSName = ActiveSheet.Name
    intlastSheetNr = Sheets.Count
    Application.ScreenUpdating = False
    For intSheetCounter = 1 To intlastSheetNr Step 1
        Sheets(intSheetCounter).Activate
        strWsName = ActiveSheet.Name
       Select Case strWsName
            Case "Physical Disks"
                bDoSomething = True
	    Case "CPGs"
                bDoSomething = True
	    Case "VirtualVolumes"
                bDoSomething = True
	    Case "Memory"
                bDoSomething = True
	    Case "UserTrace Footprints"
                bDoSomething = True
	    Case "CallTrace Footprints"
                bDoSomething = True
	    Case "StackTrace Footprints"
                bDoSomething = True
	    Case "BackTrace Footprints"
                bDoSomething = True
            Case Else
                bDoSomething = False
        End Select
        If bDoSomething = True Then
            intIndex = 60000
            Do While Not IsEmpty(Range("A" & intIndex)) 
                CreateDataBarsOnWS strWsName, Range("A" & intIndex), Range("B" & intIndex), Range("C" & intIndex), Range("D" & intIndex), Range("E" & intIndex)
                intIndex = intIndex + 1
            Loop
        End If
    Next
    Sheets(strActiveWSName).Select               ' Return to original Sheet
    Application.ScreenUpdating = True
End Sub

Function CreateDataBarsOnWS(strWsName As String, chColumn As String, intFirstLine As Integer, intLastLine As Integer, strType as String, strColor as String)
    Dim cfDataBar As Databar
    Range(chColumn & intFirstLine & ":" & chColumn & intLastLine).Select
    'Create a data bar with default behavior.
    Set cfDataBar = Selection.FormatConditions.AddDatabar
    'The MinPoint and MaxPoint properties return a ConditionValue object
    'that you can use to change the threshold parameters.
    cfDataBar.MinPoint.Modify newtype:=xlConditionValueNumber, newvalue:=0
    cfDataBar.MaxPoint.Modify newtype:=xlConditionValueNumber, newvalue:=100
    Select Case strType
        Case "solid" 
            cfDataBar.BarFillType = xlDataBarFillSolid
            Select Case strColor
                Case "red"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(255, 0, 0)
		        .TintAndShade = 0
                    End With
                Case "green"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(0, 255, 0)
		        .TintAndShade = 0
                    End With
                Case "yellow"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(255,255,0)
		        .TintAndShade = 0
                    End With
                Case "blue"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(0, 0, 255)
		        .TintAndShade = 0
                    End With
                Case "silver"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(192,192,192)
		        .TintAndShade = 0
                    End With
                Case "gray"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(128,128,128)
		        .TintAndShade = 0
                    End With
            End Select
        Case "gradient"
            cfDataBar.BarFillType = xlDataBarFillGradient
            Select Case strColor
                Case "red"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(255, 0, 0)
		        .TintAndShade = 0
                    End With
                Case "green"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(0, 255, 0)
		        .TintAndShade = 0
                    End With
                Case "yellow"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(255,255,0)
		        .TintAndShade = 0
                    End With
                Case "blue"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(0, 0, 255)
		        .TintAndShade = 0
                    End With
                Case "silver"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(192,192,192)
		        .TintAndShade = 0
                    End With
                Case "gray"
                    With Selection.FormatConditions(1).BarColor
		        .Color = RGB(128,128,128)
		        .TintAndShade = 0
                    End With
            End Select
    End Select
    Range("A1:A1").Select

End Function

