Posts by EriRuk

    Hi All,


    I have looked for it everywhere but do not seem to get an answer for the problem.
    I have a Gantt chart (graph) created in excel and would like to have a code to change the minimum x axis value automatically. Codes that are for other graphs do not seem to work with the Gantt chart...
    Any help would be very much appreciated!

    Hi All,


    I have a simple VBA function to change the sheet and graph names according to the name provided in a specific cell. Everything is working fine, however, I would like to have an error check which would stop the command and display a message box. I manage to display message box but the sheet name still changes. I'm providing my function below. Where do I need to change it to work properly? Thank you in advance!


    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range
    Set KeyCells = Range("B30")


    If Not Application.Intersect(KeyCells, Range(Target.Address)) _ Is Nothing Then
    On Error GoTo ErrorHandler


    With ActiveSheet
    .ListObjects(1).Name = Range("B30")
    End With


    ActiveSheet.Name = "Pr_" & Range("B30").Value


    ErrorHandler:
    If Err Then
    MsgBox "Name not valid!"
    Err.Clear
    End If


    End If


    End Sub