Skip to content

Instantly share code, notes, and snippets.

@footballqq
Last active June 6, 2017 04:57
Show Gist options
  • Save footballqq/fca6a2090b637c3bf8885e9adae577ed to your computer and use it in GitHub Desktop.
Save footballqq/fca6a2090b637c3bf8885e9adae577ed to your computer and use it in GitHub Desktop.
Excel Marco for filldown(act like double click filldown) Excel宏,能代替双击单元格右下角的功能,向下填充
#from: Bill Manville replied on August 18, 2010See post history
#MVP Insider MCC: Content Creator
#https://answers.microsoft.com/en-us/office/forum/office_2007-excel/shortcut-key-for-fill-handle/b839e82b-72f1-4631-9463-f92d62387d64
#https://support.office.com/en-us/article/Copy-your-macros-to-a-Personal-Macro-Workbook-aa439b90-f836-4381-97f0-6e4c3f5ee566
#also: http://dmcritchie.mvps.org/excel/fillhand.htm
Sub FillHandle()
If IsEmpty(ActiveCell.Value) Then Exit Sub
If ActiveCell.Row = Rows.Count Then Exit Sub
If ActiveCell.Column > 1 Then
If Not IsEmpty(ActiveCell.Offset(, -1)) And Not IsEmpty(ActiveCell.Offset(1, -1)) Then
Range(ActiveCell, ActiveCell.Offset(, -1).End(xlDown).Offset(, 1)).FillDown
Exit Sub
End If
End If
If ActiveCell.Column < Columns.Count Then
If Not IsEmpty(ActiveCell.Offset(, 1)) And Not IsEmpty(ActiveCell.Offset(1, 1)) Then
Range(ActiveCell, ActiveCell.Offset(, 1).End(xlDown).Offset(, -1)).FillDown
Exit Sub
End If
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment