Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically filling fields | Excel Discussion (Misc queries) | |||
The sum amount total does not equal the the individual cells. | Excel Discussion (Misc queries) | |||
Filling fields when sending a workbook. | Excel Discussion (Misc queries) | |||
What is best method of filling in fields on an MS Word Document? | Excel Programming | |||
Program a drop down list to show a specific response depending on the selction | Excel Programming |