How to automatically change the visual value after changing number format?

vonguyenphu

New Member
Joined
May 26, 2019
Messages
27
I wrote a macro to change format of cell by adding pre-fix "19V". The format change under the hood but the value I see only change after I go to the cell and press Enter.
How to automatically change the visual value as well?

Code:
Selection.NumberFormat = """19V""@"
Eg: 12345 => 19V12345 (visual only, the actual value is still 12345)
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,537
Office Version
365
Platform
Windows
Try this instead

Code:
Selection.NumberFormat = """19V""0"
 

Forum statistics

Threads
1,089,653
Messages
5,409,541
Members
403,270
Latest member
Man237

This Week's Hot Topics

Top