ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with marco (https://www.excelbanter.com/excel-programming/378594-re-help-marco.html)

Gary Keramidas

Help with marco
 
i seen significant speed differences when running code after opening the vbe.
even if i close it, code runs slower. but if i quit , restart excel and then run
the code, it is fast again. open and close the code editor, it slows down.

--


Gary


"Scott_goddard" wrote in message
...
Below is a marco i have in a sheet. What i would like to do is add these
things, i am not sure where or how

No tick marks on the y 0r x axes,
between tick marks labels to be 1,
Back ground none
Vertical grid lines - max

Any help?


Sub MakeGanttChart()

Dim GanttChartRange As Range

'get to worksheet

ActiveSheet.Activate
Set StartCell = ActiveCell

'find the data range and assign it to GanttChartRange

Range("GanttAnchor").Select
TaskCount = 1

Do
ActiveCell.Offset(1, 0).Select
TaskCount = TaskCount + 1
Loop Until ActiveCell.Value = ""

Set GanttChartRange = Range("GanttAnchor").Offset(-1, 0).Resize(TaskCount, 4)

'Back to where we began

StartCell.Select

'Make and format Gantt Chart

Charts.Add
With ActiveChart
.ChartWizard Source:=GanttChartRange, Gallery:=xlBar, Format:=3,
PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1, HasLegend:=1,
Title:=Title, CategoryTitle:="", ValueTitle:="", ExtraTitle:=""
.SeriesCollection(1).Border.LineStyle = xlNone
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlCategory).Crosses = 4 'TaskCount
.Axes(xlValue).MinimumScale = GanttChartRange.Cells(1, 1).Value
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.Size = 10
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.Size = 10
.Legend.Font.Name = "Arial"
.Legend.Font.Size = 12
.HasTitle = True
.ChartTitle.Text = Range("GanttTitle").Value
.ChartTitle.Font.Name = "Arial"
.ChartTitle.Font.Size = 18
.ChartTitle.Font.Bold = False
End With

End Sub




Gary Keramidas

Help with marco
 
ignore, missed by one post

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i seen significant speed differences when running code after opening the vbe.
even if i close it, code runs slower. but if i quit , restart excel and then
run the code, it is fast again. open and close the code editor, it slows down.

--


Gary


"Scott_goddard" wrote in message
...
Below is a marco i have in a sheet. What i would like to do is add these
things, i am not sure where or how

No tick marks on the y 0r x axes,
between tick marks labels to be 1,
Back ground none
Vertical grid lines - max

Any help?


Sub MakeGanttChart()

Dim GanttChartRange As Range

'get to worksheet

ActiveSheet.Activate
Set StartCell = ActiveCell

'find the data range and assign it to GanttChartRange

Range("GanttAnchor").Select
TaskCount = 1

Do
ActiveCell.Offset(1, 0).Select
TaskCount = TaskCount + 1
Loop Until ActiveCell.Value = ""

Set GanttChartRange = Range("GanttAnchor").Offset(-1, 0).Resize(TaskCount, 4)

'Back to where we began

StartCell.Select

'Make and format Gantt Chart

Charts.Add
With ActiveChart
.ChartWizard Source:=GanttChartRange, Gallery:=xlBar, Format:=3,
PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1, HasLegend:=1,
Title:=Title, CategoryTitle:="", ValueTitle:="", ExtraTitle:=""
.SeriesCollection(1).Border.LineStyle = xlNone
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlCategory).Crosses = 4 'TaskCount
.Axes(xlValue).MinimumScale = GanttChartRange.Cells(1, 1).Value
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.Size = 10
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.Size = 10
.Legend.Font.Name = "Arial"
.Legend.Font.Size = 12
.HasTitle = True
.ChartTitle.Text = Range("GanttTitle").Value
.ChartTitle.Font.Name = "Arial"
.ChartTitle.Font.Size = 18
.ChartTitle.Font.Bold = False
End With

End Sub







All times are GMT +1. The time now is 07:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com