Macro for Fill handle

  • Hi all,


    I am new to VBA and keen to learn.

    Want to create a fill handle macro function to copy down the content in cell 'I3' ( which is a drop-down list) to correspond to the number of rows in column H( The number of rows is variable each day)


    I know this can be done by double-clicking the fill handle, however, this sheet is being shared by others and want to make it easier for them.


    So far I looked up and found the below code, which is not working.


    Code
    Range("I3").AutoFill Destination:=Range("I3:I" & Cells(Rows.Count, "H").End(xlUp).Row)


    Can you please help.


    Thanks in advance.:)

  • Hello and Welcome to the Forum :)


    Could you explain what " does not work " with the instruction you posted ... as it looks fine ...


    By the way ... images do not help ...:thumbdown::cursing: .... please attach a sample ....Excel .... file ;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hello again,


    Probably misunderstood your question ...


    If you want to replicate the fill handle ... you can test following event macro

    Code
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Address <> "$I$3" Then Exit Sub
    Target.AutoFill Destination:=Range("I3:I" & Cells(Rows.Count, "H").End(xlUp).Row)
    Cancel = True
    End Sub


    This macro is to be stored in the Sheet Module (...not in a standard module ...) and a double-click on cell I3 will trigger the Autofill ...


    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • If I am not mistaken ... you have attached a sample file ... WITHOUT ... the macro which need to be tested ...:S

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Where is the code. Your workbook does not contain any.


    Make sure the code is entered in the correct place, read


    Where to put your Excel VBA Code

  • Glad to hear you could fix your problem :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!