LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default format a formula to general (not text)

The cells are Text formatted.

Simply changing the format will not do the trick as you have found.

Try this construct

With ActiveCell
.Formula = "=TRIM(Z4)"
.NumberFormat = "General"
.Value = .Value 'same as F2Enter
End With


Gord Dibben MS Excel MVP

On Tue, 16 Mar 2010 14:58:01 -0700, Emma Aumack
wrote:

I am importing a text (.csv) file into excel and formatting it via a Macro.
in one column I have to insert a formula but when I do so, the formula is
showing, i.e. "=TRIM(Z4)". I have tried to format to "general" but it
doesn't work unless I click inside the cell and press enter. How do I apply
the "General" formatting without have to manually click inside the cell? I
want to do it in my macro.

Here is my code:

ActiveCell.Formula = "=TRIM(Z4)"
Selection.NumberFormat = "General"


 
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
Vlookup,format general, format text techguy99 New Users to Excel 2 April 10th 09 01:35 AM
Format text to general Gator Excel Discussion (Misc queries) 2 September 9th 08 04:24 PM
Converting general text format to date Sarah (OGI) Excel Discussion (Misc queries) 6 June 20th 08 02:24 PM
Format: General - Text - General iturnrocks Excel Worksheet Functions 3 August 11th 06 04:47 PM
VBA automatically change text format into general format? Nicawette Excel Programming 2 June 13th 06 01:35 PM


All times are GMT +1. The time now is 08:52 AM.

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

About Us

"It's about Microsoft Excel"