Posts by nilem

    Re: Replace middle words with dash '-'; as in years, also with commas if not continuo


    UDF


    sample

    Code
    =ConcNum(A1)

    Re: Replace middle words with dash '-'; as in years


    try

    Re: VBA to go to different worksheets from data in a Userform ComboBox


    Hi Paul103,
    maybe something like this

    Code
    Private Sub CommandButton1_Click()    'Enter Data button
    Dim wshName As String
    With Me.ComboBox1
        wshName = .List(.ListIndex, 1)
    End With
    Sheets(wshName).Cells(Rows.Count, 1).End(xlUp)(2, 1).Resize(, 2).Value _
            = Array(Me.TextBox1, Me.TextBox2)
    End Sub

    Re: Activating Option Button in VBA code


    Hi Mike,
    try this

    Code
    Sub Clear_All_R1()
    Range("G6:G13").ClearContents
    With ActiveSheet
        .DrawingObjects("Option Button 64").Value = True
        .DrawingObjects("Option Button 71").Value = True
        .DrawingObjects("Option Button 76").Value = True
    End With
    End Sub


    or just this

    Code
    Sub Clear_All_R1()
    Range("G6:G13").ClearContents
    Range("J6,J9,J12").Value = 4
    End Sub

    Re: UDF to repeat strings according to parameters in a random sequence


    ... and maybe so

    Re: how to optmise vba code


    Hi lcmto,
    try to make a few lines out of the loop
    something like this

    Re: Vba function to concatenate header with exclusive values


    slight changes

    Re: Macro runs slow when multiple subs are called


    Hi Artie5678,
    it may be easier to use cell shading instead of creating AutoShapes. Try changing this part of the code in the CreateChartBars procedure

    Code
    ...
        Else
            'Determine location of rectangle
    '        Left = 1 + Range(Cells(1, 1), Cells(1, LeftBarCol - 1)).Width
    '        Top = 1 + Range(Cells(1, 1), Cells(a - 1, 1)).Height
    '        Width = -1 + Range(Cells(1, LeftBarCol), Cells(1, RightBarCol)).Width
    '        Height = Cells(a, 1).Height
            Range(Cells(a, LeftBarCol), Cells(a, RightBarCol)).Interior.ColorIndex = 43 '<~~~ This line
        End If
    ...


    and I think you've written a lot of redundant code

    Re: UDF results changing when clicking on different sheets


    maybe so