gmcgough600
New Member
- Joined
- Nov 21, 2017
- Messages
- 33
- Office Version
- 365
Hi, looking for some help writing some VBA code.
I need to write an If statement to check if the x-axis of a chart is formatted as a date (doesn't matter if its dd-mmm-yy or dd/mm/yyyy, mm/dd/yyyy etc) then run some other code. Here's what I've got so far:
Hope someone can help, thanks!
I need to write an If statement to check if the x-axis of a chart is formatted as a date (doesn't matter if its dd-mmm-yy or dd/mm/yyyy, mm/dd/yyyy etc) then run some other code. Here's what I've got so far:
VBA Code:
If worksheet_charts = 1 Then
Dim sht As Worksheet
Dim CurrentSheet As Worksheet
Dim cht As ChartObject
For Each sht In ActiveWorkbook.Worksheets
For Each cht In sht.ChartObjects
'Edit the x-axis
With cht
[B]'[help needed here] If 'chart has date x-axis' Then[/B]
.Chart.Axes(xlCategory).MaximumScale = chart_end_date
.Chart.Axes(xlCategory).MinimumScale = chart_start_date
Else if
'Do nothing
End if
End With
Next cht
Next sht
End If
Hope someone can help, thanks!