LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Format of Cell with Array Formula - Using VBA

I have a form where the user selects a cell for a specific formula via
refedit, then selects whether he wants the TRIM function added to the formula
or not. Just prior to inserting the formula, I determine the format of
another cell and apply it to the cell that will contain the new formula. If
TRIM is not part of the formula, everything works fine and the cell with the
new formula has the correct format. However, if I add TRIM (and the formula
is now an array formula), when it is put into the cell, the 'underlying'
format is changed to TEXT, even though the displayed format via Format |
Cells is Currency (which is what it should be), and I cant change it
regardless of what I do. I've tried everything to correct this and have no
idea what I'm doing wrong. Any ideas where Im going wrong?????

The code:
Dim ColIndexNumberCell As Range
Dim ColIndexNumberCellAddress As String
Dim LFormulaCellAddress As String

This is the code that I use to format the cell where the new formula will go:
Set ColIndexNumberCell = Range(SelectColIndexRefEdit.Text)
ColIndexNumberCellAddress = ColIndexNumberCell.Address(False, True)
With ActiveCell
.NumberFormat = Range(ColIndexNumberCellAddress).NumberFormat
End with

Then I enter the formula WITHOUT trim (and thus not an array):
Range(LFormulaCellAddress).Formula = Me.LFormula.Caption

Then if the user selected TRIM, I take the original formula and change it to
an array:
Range(LFormulaCellAddress).FormulaArray = Range(LFormulaCellAddress).Formula

 
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
Cell format for an array formula containing text Pete Excel Worksheet Functions 2 April 15th 09 08:56 PM
Array Formula - Average from every other cell Oscar Munero Excel Discussion (Misc queries) 7 June 18th 08 10:08 AM
Format range of cells for Array formula Knox Excel Programming 3 May 18th 06 06:23 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Excel Programming 0 July 27th 05 03:59 PM
referencing the value of a cell containing an array formula KR Excel Worksheet Functions 4 July 5th 05 06:15 PM


All times are GMT +1. The time now is 02:34 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"