PC Review


Reply
Thread Tools Rate Thread

Array as defined list in sheet 'Temp'..

 
 
Sinner
Guest
Posts: n/a
 
      17th Sep 2008
Hi,

I would appreciate any help if I can use oldwords & newwords array
list as a defined range in another worksheet 'Temp'.
This way it would be flexible to change the values in sheet rather
than in code.
--------------------------------------
Sub ReplaceAll()
OldWords = Array("value1, value2,.........value(n)")
NewWords = Array("value1, value2,.........value(n)")

For i = LBound(OldWords) To UBound(OldWords)
Cells.Replace OldWords(i), NewWords(i)
Next i

End Sub
-------------------------------------

Thx.
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      17th Sep 2008
Dim OldWords As Range
Dim NewWords As Range

Set OldWords = Range("A2:A14")
Set NewWords = Range("H5:H17")
For i = 1 To OldWords.Cells.Count

NewWords.Cells(i, 1).Copy OldWords.Cells(i, 1)
Next i

etc.

--
__________________________________
HTH

Bob

"Sinner" <(E-Mail Removed)> wrote in message
news:a4b4a481-88b4-4dc2-a9ce-(E-Mail Removed)...
> Hi,
>
> I would appreciate any help if I can use oldwords & newwords array
> list as a defined range in another worksheet 'Temp'.
> This way it would be flexible to change the values in sheet rather
> than in code.
> --------------------------------------
> Sub ReplaceAll()
> OldWords = Array("value1, value2,.........value(n)")
> NewWords = Array("value1, value2,.........value(n)")
>
> For i = LBound(OldWords) To UBound(OldWords)
> Cells.Replace OldWords(i), NewWords(i)
> Next i
>
> End Sub
> -------------------------------------
>
> Thx.



 
Reply With Quote
 
Sinner
Guest
Posts: n/a
 
      17th Sep 2008
On Sep 17, 3:06*pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
> Dim OldWords As Range
> Dim NewWords As Range
>
> * * Set OldWords = Range("A2:A14")
> * * Set NewWords = Range("H5:H17")
> * * For i = 1 To OldWords.Cells.Count
>
> * * * * NewWords.Cells(i, 1).Copy OldWords.Cells(i, 1)
> * * Next i
>
> etc.
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Sinner" <ims...@gmail.com> wrote in message
>
> news:a4b4a481-88b4-4dc2-a9ce-(E-Mail Removed)...
>
>
>
> > Hi,

>
> > I would appreciate any help if I can use oldwords & newwords array
> > list as a defined range in another worksheet 'Temp'.
> > This way it would be flexible to change the values in sheet rather
> > than in code.
> > --------------------------------------
> > Sub ReplaceAll()
> > OldWords = Array("value1, value2,.........value(n)")
> > NewWords = Array("value1, value2,.........value(n)")

>
> > For i = LBound(OldWords) To UBound(OldWords)
> > * Cells.Replace OldWords(i), NewWords(i)
> > Next i

>
> > End Sub
> > -------------------------------------

>
> > Thx.- Hide quoted text -

>
> - Show quoted text -


Dear can't we define it as a dynamic name in sheet and use that name
in code instead of range??

Thx.
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      17th Sep 2008
Yes you can, but that doesn't change the principle of my code.

--
__________________________________
HTH

Bob

"Sinner" <(E-Mail Removed)> wrote in message
news:f59dd4dd-f6a0-433c-a990-(E-Mail Removed)...
On Sep 17, 3:06 pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
> Dim OldWords As Range
> Dim NewWords As Range
>
> Set OldWords = Range("A2:A14")
> Set NewWords = Range("H5:H17")
> For i = 1 To OldWords.Cells.Count
>
> NewWords.Cells(i, 1).Copy OldWords.Cells(i, 1)
> Next i
>
> etc.
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Sinner" <ims...@gmail.com> wrote in message
>
> news:a4b4a481-88b4-4dc2-a9ce-(E-Mail Removed)...
>
>
>
> > Hi,

>
> > I would appreciate any help if I can use oldwords & newwords array
> > list as a defined range in another worksheet 'Temp'.
> > This way it would be flexible to change the values in sheet rather
> > than in code.
> > --------------------------------------
> > Sub ReplaceAll()
> > OldWords = Array("value1, value2,.........value(n)")
> > NewWords = Array("value1, value2,.........value(n)")

>
> > For i = LBound(OldWords) To UBound(OldWords)
> > Cells.Replace OldWords(i), NewWords(i)
> > Next i

>
> > End Sub
> > -------------------------------------

>
> > Thx.- Hide quoted text -

>
> - Show quoted text -


Dear can't we define it as a dynamic name in sheet and use that name
in code instead of range??

Thx.


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      17th Sep 2008

"Sinner" <(E-Mail Removed)> wrote in message

> Dear can't we define it as a dynamic name in sheet and use that
> name in code instead of range??


Does that mean "Oh dear..." or "Dear Bob....", or "That's too expensive..."

Are you looking to replace OldWords(i) with NewWords(i) in all cells in the
sheet, or do something else.

Regards,
Peter T



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      17th Sep 2008
My mum always use to start a sentence with Dear ... when she was about to
tell me I was being stupid. There was a tone as well, but maybe Sinner meant
the same ... :-)

--
__________________________________
HTH

Bob

"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
>
> "Sinner" <(E-Mail Removed)> wrote in message
>
>> Dear can't we define it as a dynamic name in sheet and use that
>> name in code instead of range??

>
> Does that mean "Oh dear..." or "Dear Bob....", or "That's too
> expensive..."
>
> Are you looking to replace OldWords(i) with NewWords(i) in all cells in
> the sheet, or do something else.
>
> Regards,
> Peter T
>
>
>



 
Reply With Quote
 
Sinner
Guest
Posts: n/a
 
      18th Sep 2008
On Sep 17, 6:46*pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
> My mum always use to start a sentence with Dear ... when she was about to
> tell me I was being stupid. There was a tone as well, but maybe Sinner meant
> the same ... :-)
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Peter T" <peter_t@discussions> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
>
>
> > "Sinner" <ims...@gmail.com> wrote in message

>
> >> Dear can't we define it as a dynamic name in sheet and use that
> >> name in code instead of range??

>
> > Does that mean "Oh dear..." or "Dear Bob....", or "That's too
> > expensive..."

>
> > Are you looking to replace OldWords(i) with NewWords(i) in all cells in
> > the sheet, or do something else.

>
> > Regards,
> > Peter T- Hide quoted text -

>
> - Show quoted text -


I think i didn't post the reply properly. Did anyone of you got the
reply?? : (
Bob & Peter.

Thx.
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      18th Sep 2008
Yes, and two of us replied. You haven't reverted on those.

--
__________________________________
HTH

Bob

"Sinner" <(E-Mail Removed)> wrote in message
news:d11bd441-04eb-42d5-ada6-(E-Mail Removed)...
On Sep 17, 6:46 pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
> My mum always use to start a sentence with Dear ... when she was about to
> tell me I was being stupid. There was a tone as well, but maybe Sinner
> meant
> the same ... :-)
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Peter T" <peter_t@discussions> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
>
>
> > "Sinner" <ims...@gmail.com> wrote in message

>
> >> Dear can't we define it as a dynamic name in sheet and use that
> >> name in code instead of range??

>
> > Does that mean "Oh dear..." or "Dear Bob....", or "That's too
> > expensive..."

>
> > Are you looking to replace OldWords(i) with NewWords(i) in all cells in
> > the sheet, or do something else.

>
> > Regards,
> > Peter T- Hide quoted text -

>
> - Show quoted text -


I think i didn't post the reply properly. Did anyone of you got the
reply?? : (
Bob & Peter.

Thx.


 
Reply With Quote
 
Sinner
Guest
Posts: n/a
 
      18th Sep 2008
On Sep 18, 5:54*pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
> Yes, and two of us replied. You haven't reverted on those.
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Sinner" <ims...@gmail.com> wrote in message
>
> news:d11bd441-04eb-42d5-ada6-(E-Mail Removed)...
> On Sep 17, 6:46 pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
>
>
>
>
>
> > My mum always use to start a sentence with Dear ... when she was about to
> > tell me I was being stupid. There was a tone as well, but maybe Sinner
> > meant
> > the same ... :-)

>
> > --
> > __________________________________
> > HTH

>
> > Bob

>
> > "Peter T" <peter_t@discussions> wrote in message

>
> >news:(E-Mail Removed)...

>
> > > "Sinner" <ims...@gmail.com> wrote in message

>
> > >> Dear can't we define it as a dynamic name in sheet and use that
> > >> name in code instead of range??

>
> > > Does that mean "Oh dear..." or "Dear Bob....", or "That's too
> > > expensive..."

>
> > > Are you looking to replace OldWords(i) with NewWords(i) in all cells in
> > > the sheet, or do something else.

>
> > > Regards,
> > > Peter T- Hide quoted text -

>
> > - Show quoted text -

>
> I think i didn't post the reply properly. Did anyone of you got the
> reply?? : (
> Bob & Peter.
>
> Thx.- Hide quoted text -
>
> - Show quoted text -


O : (

Bob : ) I use dear to everyone.. a habbit i.e. : ) so it was dear
Bod : )

Dear both actually I was looking for a way to replace text in a sheet
'data' base on criteria in a sheet 'temp'. The criteria is in

I have already tried with vlookup but its very time consuming.
Secondly the the ranges of both data & criteria are dynamic. So for
above code, I have to change the range as per requirement. Lets say I
define the data range as a name 'DATA' and criteria as 'CRT'. This way
the macro will be intact & if the ranges changes, I will need to alter
the name range rather than the range values in code.

Lastly the replacement should be irrespective of CaSE, case, CASE
sensitivity.
The previous code replaced words exactly as mentioned in the 'Temp'
sheet which it should not do.

Sample file is at http://www.savefile.com/files/1777260

Thx for your replies.
 
Reply With Quote
 
Sinner
Guest
Posts: n/a
 
      26th Sep 2008
On Sep 18, 11:14*pm, Sinner <ims...@gmail.com> wrote:
> On Sep 18, 5:54*pm, "Bob Phillips" <Bob...@somewhere.com> wrote:
>
>
>
>
>
> > Yes, and two of us replied. You haven't reverted on those.

>
> > --
> > __________________________________
> > HTH

>
> > Bob

>
> > "Sinner" <ims...@gmail.com> wrote in message

>
> >news:d11bd441-04eb-42d5-ada6-(E-Mail Removed)...
> > On Sep 17, 6:46 pm, "Bob Phillips" <Bob...@somewhere.com> wrote:

>
> > > My mum always use to start a sentence with Dear ... when she was about to
> > > tell me I was being stupid. There was a tone as well, but maybe Sinner
> > > meant
> > > the same ... :-)

>
> > > --
> > > __________________________________
> > > HTH

>
> > > Bob

>
> > > "Peter T" <peter_t@discussions> wrote in message

>
> > >news:(E-Mail Removed)...

>
> > > > "Sinner" <ims...@gmail.com> wrote in message

>
> > > >> Dear can't we define it as a dynamic name in sheet and use that
> > > >> name in code instead of range??

>
> > > > Does that mean "Oh dear..." or "Dear Bob....", or "That's too
> > > > expensive..."

>
> > > > Are you looking to replace OldWords(i) with NewWords(i) in all cells in
> > > > the sheet, or do something else.

>
> > > > Regards,
> > > > Peter T- Hide quoted text -

>
> > > - Show quoted text -

>
> > I think i didn't post the reply properly. Did anyone of you got the
> > reply?? : (
> > Bob & Peter.

>
> > Thx.- Hide quoted text -

>
> > - Show quoted text -

>
> O : (
>
> Bob : ) I use dear to everyone.. a habbit i.e. : ) so it was dear
> Bod : )
>
> Dear both actually I was looking for a way to replace text in a sheet
> 'data' base on criteria in a sheet 'temp'. The criteria is in
>
> I have already tried with vlookup but its very time consuming.
> Secondly the the ranges of both data & criteria are dynamic. So for
> above code, I have to change the range as per requirement. Lets say I
> define the data range as a name 'DATA' and criteria as 'CRT'. This way
> the macro will be intact & if the ranges changes, I will need to alter
> the name range rather than the range values in code.
>
> Lastly the replacement should be irrespective of CaSE, case, CASE
> sensitivity.
> The previous code replaced words exactly as mentioned in the 'Temp'
> sheet which it should not do.
>
> Sample file is athttp://www.savefile.com/files/1777260
>
> Thx for your replies.- Hide quoted text -
>
> - Show quoted text -


Dim OldWords As Range
Dim NewWords As Range

Set OldWords = Range("A2:A14")
Set NewWords = Range("H5:H17")
For i = 1 To OldWords.Cells.Count


NewWords.Cells(i, 1).Copy OldWords.Cells(i, 1)
Next i


I want the Range(Old List), Range(New list) to be a defined name
How do I do that??
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defined named range (Array list) Sinner Microsoft Excel Programming 2 16th Feb 2008 02:17 PM
Copying A Range of Cells From one Sheet to Another - Error Application Defined or Object Defined Matt Microsoft Excel Programming 3 25th Jul 2006 01:13 AM
Generics or User defined Type safe Array List =?Utf-8?B?TWFjY2E=?= Microsoft C# .NET 1 30th May 2006 11:54 AM
Print Sheet Array from List Box =?Utf-8?B?U3Rhbko=?= Microsoft Excel Programming 2 6th Sep 2005 05:15 PM
no array defined James Whitehead Computer Hardware 3 18th Sep 2003 06:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 PM.