Autoformatting/VBA to fix?

Realtreegirl75

New Member
Joined
Aug 28, 2022
Messages
31
Office Version
  1. 365
Platform
  1. Windows
There is a cell in Excel that I need to type 22E113. This autoformats to 2.20E+114 but I need it to stay the same. I know I can type a ' in front of it each time but I will be distributing this sheet to people who will not remember that lol. Is there a way to write code into the worksheet that will add the ' in front of it each time so that it will stay the same as what anyone is typing in? I found this code on another site that kind of works but doesn't stop the text from autoformatting. I've tried to tweak it but I'm not having much luck...Any help would be so appreciated!!

Sub AppendToExistingOnLeft()
Dim c As Range
For Each c In Selection
If c.Value <> "" Then c.Value = "CN- " & c.Value
Next
End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi - Have you tried the simple way of turning it off ? Excel Options - Formulas - under "Error checking rules" - un-check "Numbers formatted as text or preceded by an apostrophe".

It can allow you to type the numbers with text without converting it.
 
Upvote 0
If you simply change the cell format to "Text" before typing these values in, Excel will not convert them.
 
Upvote 0
Solution
I feel like an absolute dope for not thinking of that! Thank you @Joe4 that made my life much easier than I thought it was going to be!!
 
Upvote 0
You are welcome.

Yep, the "Text" format is the key if you want Excel to keep enter every single character you enter and not perform any automatic conversions or changes to it.
 
Upvote 0

Forum statistics

Threads
1,215,206
Messages
6,123,638
Members
449,109
Latest member
Sebas8956

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
Back
Top