Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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
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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
VBA - Modify data in selection Clayman Excel Programming 3 July 25th 08 12:56 PM
How to create a selection list then display the selection in a cell [email protected] Excel Programming 0 August 1st 07 03:01 PM
Modify a calculated field formula depending upon selection of pagefield Tewari Excel Discussion (Misc queries) 0 April 10th 07 01:35 PM
"Modify Selection" button is grayed out Stove79 Excel Discussion (Misc queries) 1 December 8th 05 09:56 PM


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