Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default how to program the equal filling out of an individual selction of fields?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default how to program the equal filling out of an individual selction of

Enter this tiny macro:

Sub gsnu()
Dim v As Variant
v = InputBox("Enter content: ")
For Each r In Selection
r.Value = v
Next
End Sub

First select the cells you want to fill and run the macro.
--
Gary's Student


"Marcel Marien" wrote:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default how to program the equal filling out of an individual selction of fields?

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default how to program the equal filling out of an individual selction of fields?

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default how to program the equal filling out of an individual selction of fields?

Marcel, thanks for clarifying this. Your solution is clearly more
elegant. I think I had tried this before, but I was probably trying to
apply formatting at the same time, which will not work this way, as I
recall, so my advice was not the most elegant. The best part of this
site is that when I attempt to help someone I almost always learn
something, as well. James

Marcel Marien wrote:
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



Reply
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
Automatically filling fields answerproject Excel Discussion (Misc queries) 2 February 23rd 09 04:06 PM
The sum amount total does not equal the the individual cells. Excel @sum does not equal Excel Discussion (Misc queries) 1 July 28th 08 04:56 PM
Filling fields when sending a workbook. Flima Excel Discussion (Misc queries) 0 February 15th 06 08:24 PM
What is best method of filling in fields on an MS Word Document? alruff[_2_] Excel Programming 0 October 6th 04 09:19 PM
Program a drop down list to show a specific response depending on the selction Vita Cator Excel Programming 1 October 30th 03 07:12 PM


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