Keyboard Shortcut Question

Russ At Index

Well-known Member
Joined
Sep 23, 2002
Messages
696
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Hi,

There are , as Smitty once famously posted on this site , hundreds
no n thousands of Excel keyboard shortcuts ( Hi Smitty) ,

I am looking for a keyboard shortcut that will just enter a month ,
not necessarily the current one but one of the users choice.

Where ctrl + ; will give you 27/07/2010 , i am after something similar
but with just the month , say ctrl + ; + 1 would enter January .......

Thankfully the above isn't the answer !!!

Any ideas , as always appreciated ,

TIA

Russ
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

macness

New Member
Joined
Jul 27, 2010
Messages
37
You're probably looking at some VBA to tie a sub to a keystroke.

You can always use a =month(thedate) where 'thedate' is a cell reference to a date or a serial date for excel.
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I would decide what range you want this to happen in and use the Change Event.

Say you want this to happen in the range of A1:A12

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, d As Range
Set d = Intersect(Target, Range("A1:A12"))
If d Is Nothing Then Exit Sub
Application.EnableEvents = False
    For Each c In d
        If IsNumeric(c) And c <> "" Then c = Format((c Mod 12) * 29, "mmmm")
    Next
Application.EnableEvents = True
End Sub

[/CODE]

Then you could just type the month number in this range, and it will change it to the month name
 
Last edited:

Russ At Index

Well-known Member
Joined
Sep 23, 2002
Messages
696
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Hi Hotpepper ,

Brilliant piece of code , thank you ,

Possible addition to code to have the year ( yy)
after your keystroke , so 1 would give me January 10 ??

Thanks Again ,

Russ
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,275
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hi Russ
I don't believe there is such a creature

Ctrl +semi colon = Date
Ctrl + Shift + # = Changes the Format to (Day, Month, Year)

I'd suggest a Macro would be the other option

I'm willing to bet someone can prove me wrong though.....LOL !!
 

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
or
Code:
Sub EnterMonth()
 
  'Can be assigned to a shortcut key from Excel via ALT-F8, select the macro and then options.
 
  Dim i As Variant
  On Error Resume Next
  i = InputBox(Prompt:="Enter month number? [1 to 12]", Title:="Month Entry", Default:=1)
  Select Case i
    Case 1 To 12: Selection.Value2 = "'" & Format$(DateSerial(Year(Date), i, 1), "mmmm yy")
    Case Else
  End Select
 
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,923
Messages
5,834,382
Members
430,282
Latest member
MeredithD26

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top