Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default Change macro to formula?

By selecting B6 and applying Claus's macro below I get the correct
result displayed (having merged a few cells).

https://www.dropbox.com/s/rhikeaorb7...als-3.jpg?dl=0

But how can I do that with a formula instead please?

Sub FormatDate()
' 2017, from Claus
' Apply to 07/01/2018 (anywhere) to get Sunday 7th January 2018
' Target is formatted dd/mm/yyyy so could enter 7/1/18

Dim rngC As Range

For Each rngC In Selection
If IsDate(rngC) Then
Select Case Day(rngC)
Case 1, 21, 31
rngC.NumberFormat = "dddd d""st"" mmmm yyyy"
Case 2, 22
rngC.NumberFormat = "dddd d""nd"" mmmm yyyy"
Case 3, 23
rngC.NumberFormat = "dddd d""rd"" mmmm yyyy"
Case Else
rngC.NumberFormat = "dddd d""th"" mmmm yyyy"
End Select
End If
rngC = rngC.Text
Next
End Sub

BTW, I can no longer reach the link Claus originally provided about this
macro:

https://onedrive.live.com/redir?resi...=folder%2cxlsm

I get "This item might not exist or is no longer available."

Terry, East Grinstead, UK
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Change macro to formula?

Hi,

Am Tue, 06 Feb 2018 16:19:58 +0000 schrieb Terry Pinnell:

By selecting B6 and applying Claus's macro below I get the correct
result displayed (having merged a few cells).

https://www.dropbox.com/s/rhikeaorb7...als-3.jpg?dl=0

But how can I do that with a formula instead please?


a formula can't change a format. But you could try the formulas in the
conditional formatting.

BTW, I can no longer reach the link Claus originally provided about this
macro:


I uploaded the workbook again:
https://1drv.ms/x/s!AqMiGBK2qniTgcFwk6ClS7kz-lZnvQ



Regards
Claus B.
--
Windows10
Office 2016
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default Change macro to formula?

Claus Busch wrote:

Hi,

Am Tue, 06 Feb 2018 16:19:58 +0000 schrieb Terry Pinnell:

By selecting B6 and applying Claus's macro below I get the correct
result displayed (having merged a few cells).

https://www.dropbox.com/s/rhikeaorb7...als-3.jpg?dl=0

But how can I do that with a formula instead please?


a formula can't change a format. But you could try the formulas in the
conditional formatting.

BTW, I can no longer reach the link Claus originally provided about this
macro:


I uploaded the workbook again:
https://1drv.ms/x/s!AqMiGBK2qniTgcFwk6ClS7kz-lZnvQ



Regards
Claus B.


Thanks Claus.

Terry, East Grinstead, UK
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula or macro to change a formula in muliple spreadsheets [email protected] Excel Programming 1 May 21st 09 05:27 PM
Macro to change a formula to a value Carl Excel Worksheet Functions 1 November 8th 06 02:29 AM
Macro To Change a Formula to A Value Carl Excel Worksheet Functions 2 October 13th 06 09:21 AM
Change Formula with Macro [email protected] Excel Programming 4 May 17th 06 07:18 PM
Macro to change row number within formula mpot4 Excel Programming 2 September 21st 05 03:55 AM


All times are GMT +1. The time now is 02:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"