View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
dspilberg dspilberg is offline
external usenet poster
 
Posts: 32
Default Writing own formula

Paul,

I think the 23 is ok, because I usually use it (it means the selection of
all formulas: numbers, text, errors and logics).

And the selection should never be a set of empty cells (I verified that)
because i go to a sheet and chose cells.select .

Thanks once more!




" wrote:

Hi
The 23 seems Ok - probably a combination of the values allowed
(16+4+2+1 ??). Have you checked that

Selection.SpecialCells(xlCellTypeConstants, 23).Select

is not empty (which would happen if your selection was a set of empty
cells)?
regards
Paul

On Jun 18, 11:34 am, wrote:
Hi
What does the 23 refer to in your SpecialCells? The value normally
refers to text, numbers, true/false or errors.
regards
Paul
On Jun 18, 11:19 am, dspilberg
wrote:



Same error.


Thanks anyway!


" wrote:
Hi
I don't know what your selection is but try


For each cell in Selection
cell.FormulaR1C1 = "=" & formula
next cell


regards
Paul


On Jun 18, 10:27 am, dspilberg
wrote:
Thanks Paul, but it still doesn't work.
It shows the message error '1004' (my excel is in portuguese and i don't
what the message would be in english).
Regards!


" wrote:
Hi
Try
Selection.FormulaR1C1 = "=" & formula


regards
Paul


On Jun 18, 9:53 am, dspilberg
wrote:
My objective is to create a file of consolidation of identical files, but
with different values in the cells. So I have to maintain the formulas and
sum the values.


The problem is that I created my own formula as the code bellow (onglet is
the sheetname) and Excel writes in the cells the formula itself, it does not
calculate it as I expected. For exemple, it returns:


+Plan1!+Plan2! and not the value of the sum of the 2 cells.


What should I do???


Thanks in advance.


Daniel (Brazil)


Dim formula As Variant


Sheets("Input").Select


For a = 2 To 3
If Cells(a, 1).Value = True Then
Onglet = Cells(a, 3).Value
formula = formula & "+" & Onglet & "!" & RC


End If
Next a


Sheets("Conso").Select
Cells.Select
Selection.SpecialCells(xlCellTypeConstants, 23).Select
Selection.FormulaR1C1 = formula


End Sub- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -