xlf | FillHdlDblClk


Emulate the Fill Handle Double Click procedure


A VBA sub procedure to emulate the Excel fill handle double click (FillHdlBdlClk) procedure for a selection.


FillHdlDblClk - the VBA code



Code 1: Sub procedure FillHdlDblClk emulate the Excel double click fill handle process
Sub FillHdlDblClk()
'' Macro shortcut: Ctrl + Shift + d
'' No error checking

Dim row1 As Long
Dim row2 As Long
Dim cols As Integer

    With Selection
        cols = .Columns.Count
        row1 = .Row
        row2 = .Offset(0, -1).End(xlDown).Row
        .Copy
        .Offset(0, 0).Resize(row2 - row1 + 1, cols).Select
    End With

        Selection.PasteSpecial _
            Paste:=xlPasteFormulasAndNumberFormats
        Application.CutCopyMode = False

End Sub											

To use the code

  1. Copy and paste the code 1 procedure to a VBA module
  2. In Excel, open the Macro dialog and select the FillHdlDblClk macro
  3. Then Click the Options button to open the Macro Options dialog as shown in figure 1
  4. Add the shortcut key Ctrl+Shift+D
  5. Complete the Description panel

  6. xlf-fillhdldblclk-shortcut
    Fig 1: Macro options dialog - change the shortcut key and description

  7. Click OK