View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Marcel Marien Marcel Marien is offline
external usenet poster
 
Posts: 17
Default how to program the equal filling out of an individual selction of fields?

Dear James,

thanks for your solution. In the meantime I have found out that the
solution:
Selection.Value = "x"
works perfectly fine - only that by mistake I kept calling the wrong macro
and thus everything I tried seemed to yield no result.

Marcel


"Zone" schrieb im Newsbeitrag
ups.com...
Give this a try. James

Sub InsVal()
Dim t As Integer, c As Long
With Selection
For t = 1 To .Areas.Count
For c = 1 To .Areas(t).Cells.Count
.Areas(t).Cells(c) = "x"
Next c
Next t
End With
End Sub

Marcel Marien wrote:
Maybe I haven't stated my problem very clearly.
I want to select a number of cells which do not neccessarily have to be
adjacent. Then I want to assign a value to all those cells, but without
altering their format. I have been trying 2 ways:

1)
Selection.Value = "x"

This will put the value "x" in all cells, if the cells are placed in a
continuous column and are selected from top to bottom. If they are
selected
from bottom to top or if they are not adjacent, then *only* the 1st of
the
selected cells is filled with an "x"

2)
ActiveCell.FormulaR1C1 = "a"
ActiveCell.Copy

This behaves just as does version 1). It generally puts an "x" *only*
into
the 1st of the selected cells.

Thanks a lot in advance,
Marcel


"Marcel Marien" schrieb im Newsbeitrag
...
Can anybody tell me how it is possible in Excel (office 2000) to insert
by
program a certain content into a selection of single fields from
different
colums and rows without altering their format? It would be the
equivalent
to manually inserting a copied value into a selection of fields.

Thank you very much in advance,
Marcel