Trying to create macro to perform the "F2 + Enter"

muzikman69

New Member
Joined
Jun 19, 2007
Messages
30
I am trying to create a macro which will perform the F2 + Enter keystroke, to update formatting for cells.

My difficulty is coming in that the macro recorded below had the "1/2/2007" hard coded into it, and when the date changes on the sheet it continues by updating the cells to the above mentioned date. Is there an easy way to have the formating updated for many lines?

Thanks for any help,
Graeme


Sub F2Enter()
'
' F2Enter Macro
' Macro recorded 7/31/2007 by grander
'
' Keyboard Shortcut: Ctrl+f
'
ActiveCell.FormulaR1C1 = "1/2/2007"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
What is it you actually want to achieve?
 

muzikman69

New Member
Joined
Jun 19, 2007
Messages
30
Here is what I have


Cell A1 = 2/1/2007


I go into the cell formating, and change the format to show "Feb-07". However in order to have this new formatting appear, I seem to have to do the F2+Enter keystroke.

After keystroke cell should equal

Cell A1 = "Feb-07"


Make sense?

Graeme,
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Sounds like you have "Numbers Stored As Text"..

Try typing a 1 anywhere on your sheet, copy it.
Highlight offending range, paste special - values - multiply
 

muzikman69

New Member
Joined
Jun 19, 2007
Messages
30
Forgot one thing,,, the reason F2+Enter is required is because the date comes from a concatenate formula, then is copy and pasted as a value.... so it is formatted as text and not a date until the F2+Enter keystroke is entered...

Cheers,
Graeme,
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
adjust that formula to return a number, not text....

like say your current formula is

=concatenate(a1,b1)

change it to

=--concatenate(a1,b1)
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Why are you using CONCATENATE to create a date? Why not use a function that actually returns a date such as DATE?
 

Forum statistics

Threads
1,181,658
Messages
5,931,269
Members
436,785
Latest member
KingGideon

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