VBA not maintaining text formats

shane_aldrich

Board Regular
Joined
Oct 23, 2009
Messages
148
OK...this is a weird one. I have VBA code that fills down some formulas. I noticed that it keeps changing the text formatting on a few of them

In Column G I have a list of codes

4SEPT</SPAN>
278E5</SPAN>
298E8</SPAN>
46E47</SPAN>
78E54</SPAN>
25E64</SPAN>
29E88</SPAN>
88E99</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>

These codes are in text format

In column Y I use a formula =IF($X4="","",MID(G4,1,5))


For those codes above since X is not blank, it should report the same code...instead it returns

4-Sep</SPAN>
2.78E+07</SPAN>
2.98E+10</SPAN>
4.60E+48</SPAN>
7.80E+55</SPAN>
2.50E+65</SPAN>
2.90E+89</SPAN>
8.80E+100</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>

Is there a way to force it not to reformat?

Thansk,
 

Some videos you may like

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

poolhall

Active Member
Joined
Jan 9, 2009
Messages
350
You can use a leading apostrophe: '4SEPT. This will prevent your values from autoformatting.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,670
Messages
5,597,480
Members
414,143
Latest member
lonnie451

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