Mouse

G

Guest

Is there a way in Excel to add options to the right click functions for the
mouse. For example, I would like to be able to use the fill down function by
right clicking instead of using CTRL D on the keyboard.
 
G

Gord Dibben

You would need VBA event code to add the filldown command to right-click.

How about just go to Tools>Customize>Commands>Edit and drag the FillDown button
to a toolbar?

For the event code................

Sub fill()
Selection.FillDown
End Sub

Sub fill() goes into a general module.

The following two events go into the Thisworkbook module.

I suggest you open a new workbook, copy the macro and event code into that
workbook then Save As an Add-in which loads when Excel starts.

If you go that route, you don't really need the BeforeClose event.

Sub Workbook_Open()
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.BeginGroup = True
.Caption = "Fill Down"
.OnAction = "Fill"
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Controls("Fill Down").Delete
End Sub


Gord Dibben MS Excel MVP
 
G

Guest

I opted for the first choice because the rest was beyond my skill level.
That option keeps my hands off the keyboard and on the mouse which is what I
was after. Thanks.
 
G

Gord Dibben

OK

Keep the code in mind though.

A right-click after selecting a range is more intuitive IMO

You can also place commands on the "Columns" and "Rows" right-click which is
handy.

Also can add commands to the Sheet tabs("Ply") right-click menu.


Gord Dibben MS Excel MVP
 
D

David McRitchie

See if this page helps
Right Click Menus (Context Menus) in Excel
http://www.mvps.org/dmcritchie/excel/rightclick.htm

You really should be familiar with macros and the difference
between standard macros and event macros before getting
into this, more for the ability to correct something if it goes
wrong. Though the code is all shown and where it goes, this
would not be the page to start learning about macros.

I would start learning with User Defined Functions (UDF) which are installed
the same as standard macros, and for something that you
can probably get a lot of use out of, I'd suggest starting with
such UDF as GetFormula, GetFormulaD, GetFormat
http://www.mvps.org/dmcritchie/excel/formulas.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top