Hi Everybody,
After two hours trying to find this over internet, I finally gave up and I'd like to asf for your help!
Say that in one sheet I've a table with say 500 columns and 6000+ lines.
In other two sheets of the same workbook, I've made 50+ charts to get the information I want from the table. I just filter the data in the table in the first sheet, and the charts are automatically updated as I need.
I fairly new to all this VBA stuff.. but I made a code to filter data that I have in a table, and to save my two sheets as a PDF file. I'll have several files (as much as I filter different data). This code works great for this.
Here's the code:
Sub saveaspdf()
Dim n As Integer
Dim fName As String
For n = 1 To 12
Sheets("Table Database").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:=n
' filter the data I need
Sheets("Charts1").Select
With ActiveSheet
fName = .Range("A1").Value & .Range("E1").Value
.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\Users\k.cuchinskicampos\Desktop\Dashboards\" & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
'save pdf for first sheet
Sheets("Charts2").Select
With ActiveSheet
fName = .Range("A1").Value & .Range("E1").Value & .Range("I1").Value
.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\Users\k.cuchinskicampos\Desktop\Dashboards\" & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
'save pdf for second sheet
Next n
End Sub
The problem is that the resulting pdf file gets the x-scale type of each chart wrong. It displays the data in numbers format, and not as dates as I want. In the excel file, the scale type is set to "dates" and the original data is formatted as "dates" as well.
Do you have any ideas about what is going wrong?
Thanks a lot!!
After two hours trying to find this over internet, I finally gave up and I'd like to asf for your help!
Say that in one sheet I've a table with say 500 columns and 6000+ lines.
In other two sheets of the same workbook, I've made 50+ charts to get the information I want from the table. I just filter the data in the table in the first sheet, and the charts are automatically updated as I need.
I fairly new to all this VBA stuff.. but I made a code to filter data that I have in a table, and to save my two sheets as a PDF file. I'll have several files (as much as I filter different data). This code works great for this.
Here's the code:
Sub saveaspdf()
Dim n As Integer
Dim fName As String
For n = 1 To 12
Sheets("Table Database").Select
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:=n
' filter the data I need
Sheets("Charts1").Select
With ActiveSheet
fName = .Range("A1").Value & .Range("E1").Value
.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\Users\k.cuchinskicampos\Desktop\Dashboards\" & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
'save pdf for first sheet
Sheets("Charts2").Select
With ActiveSheet
fName = .Range("A1").Value & .Range("E1").Value & .Range("I1").Value
.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\Users\k.cuchinskicampos\Desktop\Dashboards\" & fName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
'save pdf for second sheet
Next n
End Sub
The problem is that the resulting pdf file gets the x-scale type of each chart wrong. It displays the data in numbers format, and not as dates as I want. In the excel file, the scale type is set to "dates" and the original data is formatted as "dates" as well.
Do you have any ideas about what is going wrong?
Thanks a lot!!