Question : nmconnect

how about in unix?.

Answer : nmconnect

also the with blocks will help reduce the redundant code, hope this is helpful
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
Public Sub UpdateChart()
  
    Dim ChtObj As ChartObject
    Dim PriceType As Long
    Set ChtObj = ActiveSheet.ChartObjects(1)
      
    Application.ScreenUpdating = False
      
    PriceType = ActiveSheet.Cells(13, 20).Value
      
    If PriceType = 1 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("$C$771:$C$1475")
            .MarkerBackgroundColorIndex = 1
            .MarkerBackgroundColorIndex = 4
        End With
        ChtObj.Visible = True
    ElseIf PriceType = 2 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("$D$771:$D$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 5
        End With
        ChtObj.Visible = True
    ElseIf PriceType = 3 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("$E$771:$E$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 3
        End With
        ChtObj.Visible = True
    ElseIf PriceType = 4 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("$I$771:$I$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 9
        End With
        ChtObj.Visible = True
    ElseIf PriceType = 5 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("$F$771:$F$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 7
        End With
        ChtObj.Visible = True
    ElseIf PriceType = 6 Then
        With ChtObj.Chart.SeriesCollection(1)
            .Values = ActiveSheet.Range("D$771:$D$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 5
        End With
        ActiveChart.SeriesCollection.NewSeries
        With ChtObj.Chart.SeriesCollection(2)
            .Values = ActiveSheet.Range("E$771:$E$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 3
        End With
        ActiveChart.SeriesCollection.NewSeries
        With ChtObj.Chart.SeriesCollection(3)
            .Values = ActiveSheet.Range("I$771:$I$1475")
            .MarkerForegroundColorIndex = 1
            .MarkerBackgroundColorIndex = 9
        End With
        ChtObj.Visible = True
    End If
    ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
  
Application.ScreenUpdating = True
  
End Sub
Random Solutions  
 
programming4us programming4us