Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify each cell in selection
I need to modify each cell in a selection, adding a string constant to the
text in each cell. ie: - a1="A" - b1="B" - c1="0" - d1="E" and I need to add "(DR1)" to each of these. I've tried researching "For Each" 'cuz I know that is what I need, but I'm not certain exactly where to go from there. My thoughts (reserved words may be ignored): For Each cell In Selection holder=cell.value holder=holder & "(DR1)" cell.value=holder Next Will this do it? -- Adios, Clay Harryman |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify each cell in selection
Your code should work but you could shorten it up a bit...
dim Cell as range for each cell in Selection cell.value = cell.value & "(DR)" nect cell -- HTH... Jim Thomlinson "Clayman" wrote: I need to modify each cell in a selection, adding a string constant to the text in each cell. ie: - a1="A" - b1="B" - c1="0" - d1="E" and I need to add "(DR1)" to each of these. I've tried researching "For Each" 'cuz I know that is what I need, but I'm not certain exactly where to go from there. My thoughts (reserved words may be ignored): For Each cell In Selection holder=cell.value holder=holder & "(DR1)" cell.value=holder Next Will this do it? -- Adios, Clay Harryman |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify each cell in selection
Typo... nect should be next...
dim Cell as range for each cell in Selection cell.value = cell.value & "(DR)" next cell -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Your code should work but you could shorten it up a bit... dim Cell as range for each cell in Selection cell.value = cell.value & "(DR)" nect cell -- HTH... Jim Thomlinson "Clayman" wrote: I need to modify each cell in a selection, adding a string constant to the text in each cell. ie: - a1="A" - b1="B" - c1="0" - d1="E" and I need to add "(DR1)" to each of these. I've tried researching "For Each" 'cuz I know that is what I need, but I'm not certain exactly where to go from there. My thoughts (reserved words may be ignored): For Each cell In Selection holder=cell.value holder=holder & "(DR1)" cell.value=holder Next Will this do it? -- Adios, Clay Harryman |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modify each cell in selection
Sanctuary much, Jim!
This worked quite well. I actually learned quite a bit during this little endeavor - mostly how the "Range" type works. I had no idea it would be that simple! -- Adios, Clay Harryman "Jim Thomlinson" wrote: Typo... nect should be next... dim Cell as range for each cell in Selection cell.value = cell.value & "(DR)" next cell -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: Your code should work but you could shorten it up a bit... dim Cell as range for each cell in Selection cell.value = cell.value & "(DR)" nect cell -- HTH... Jim Thomlinson "Clayman" wrote: I need to modify each cell in a selection, adding a string constant to the text in each cell. ie: - a1="A" - b1="B" - c1="0" - d1="E" and I need to add "(DR1)" to each of these. I've tried researching "For Each" 'cuz I know that is what I need, but I'm not certain exactly where to go from there. My thoughts (reserved words may be ignored): For Each cell In Selection holder=cell.value holder=holder & "(DR1)" cell.value=holder Next Will this do it? -- Adios, Clay Harryman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Limiting selection in a cell AND linking that selection to a list | Excel Discussion (Misc queries) | |||
VBA - Modify data in selection | Excel Programming | |||
How to create a selection list then display the selection in a cell | Excel Programming | |||
Modify a calculated field formula depending upon selection of pagefield | Excel Discussion (Misc queries) | |||
"Modify Selection" button is grayed out | Excel Discussion (Misc queries) |