Keyboard Shortcut Question

Russ At Index

Well-known Member
Joined
Sep 23, 2002
Messages
649
Office Version
365, 2016
Platform
Windows, 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
 

Some videos you may like

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,953
Office Version
365, 2010
Platform
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
649
Office Version
365, 2016
Platform
Windows, 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
19,148
Office Version
2013
Platform
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,907
Messages
5,514,091
Members
408,983
Latest member
mlee13

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top