gautammalkani
Technical User
Hi
Currently, when I run this code, I cant seem to paste special my filtered graph. I am trying to automate a process where all the filtered graphs are placed on another worksheet in the same file. Currently, I am looping for 5 different filtered locations as a test to see if my code works. I have attached my code. Please let me know if you can help me in any way possible. Thanks
Gautam
Here is my code and I get an error on the "activesheet. paste special" THe error states that it is unable to get the chartsobject property of the Worksheet class
Sub graph()
' graph Macro
' Macro recorded 9/22/03 by MALKAG
' This macro changes the name of the chart to
' what is selected using the drop down menu and sends the charts
' to another work sheet
' Press the customized macro button (smiley face)
' to apply the macro
Dim word As String
Dim heading As String
Dim i, j, k As Integer
i = 2
Dim Clli(200) As String
Sheets("0603_WcUtil"
.Select
Range("C1"
.Select
For j = 1 To 5
k = 2
Clli(1) = Range("C2"
.Value
Do While Not IsEmpty(Range("C" & k))
If Range("C" & k).Value <> Clli(k - 1) Then
Clli(k) = Range("C" & k).Value
End If
Selection.AutoFilter Field:=3, Criteria1:=Clli(j)
If Rows(2).Hidden = False Then
word = Range("C" & i).Value
heading = "T3 UTILIZATION " & word
Else
Do Until Rows(i).Hidden = False
i = i + 1
word = Range("C" & i).Value
heading = "T3 UTILIZATION " & word
Loop
End If
ActiveSheet.ChartObjects("Chart 45"
.Activate
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Caption = heading
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
Windows("final data15.xls"
.Activate
Sheets("Sheet1"
.Select
Range("A" & (((i - 2) * 17)) + 1).Select
ActiveSheet.Paste
ActiveSheet.ChartObjects("Chart " & (174 + j)).Activate
ActiveWindow.Visible = False
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", Link:=False _
, DisplayAsIcon:=False
Windows("final data15.xls"
.Activate
Sheets("0603_WcUtil"
.Select
Range("C1"
.Select
k = k + 1
Loop
Next j
End Sub
Currently, when I run this code, I cant seem to paste special my filtered graph. I am trying to automate a process where all the filtered graphs are placed on another worksheet in the same file. Currently, I am looping for 5 different filtered locations as a test to see if my code works. I have attached my code. Please let me know if you can help me in any way possible. Thanks
Gautam
Here is my code and I get an error on the "activesheet. paste special" THe error states that it is unable to get the chartsobject property of the Worksheet class
Sub graph()
' graph Macro
' Macro recorded 9/22/03 by MALKAG
' This macro changes the name of the chart to
' what is selected using the drop down menu and sends the charts
' to another work sheet
' Press the customized macro button (smiley face)
' to apply the macro
Dim word As String
Dim heading As String
Dim i, j, k As Integer
i = 2
Dim Clli(200) As String
Sheets("0603_WcUtil"
Range("C1"
For j = 1 To 5
k = 2
Clli(1) = Range("C2"
Do While Not IsEmpty(Range("C" & k))
If Range("C" & k).Value <> Clli(k - 1) Then
Clli(k) = Range("C" & k).Value
End If
Selection.AutoFilter Field:=3, Criteria1:=Clli(j)
If Rows(2).Hidden = False Then
word = Range("C" & i).Value
heading = "T3 UTILIZATION " & word
Else
Do Until Rows(i).Hidden = False
i = i + 1
word = Range("C" & i).Value
heading = "T3 UTILIZATION " & word
Loop
End If
ActiveSheet.ChartObjects("Chart 45"
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Caption = heading
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
Windows("final data15.xls"
Sheets("Sheet1"
Range("A" & (((i - 2) * 17)) + 1).Select
ActiveSheet.Paste
ActiveSheet.ChartObjects("Chart " & (174 + j)).Activate
ActiveWindow.Visible = False
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", Link:=False _
, DisplayAsIcon:=False
Windows("final data15.xls"
Sheets("0603_WcUtil"
Range("C1"
k = k + 1
Loop
Next j
End Sub