Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default VBA - Code failing in Excel 97

The following code is failing when users run in excel 97 on the "Replace" item.

Can you help?

Thanks in advance,

Scott

'----------------------------------------------------
'Remove unneeded text in column G
'----------------------------------------------------
Range("G2:G2000").Select
Dim Keywords As Variant
Dim Rng As Range
Dim Ndx As Long
Keywords = Array("Q Line ", "120 VAC ", "- Breaker ", " Standard")
For Each Rng In Selection.Cells
For Ndx = LBound(Keywords) To UBound(Keywords)
Rng.Value = Replace(Rng.Text, Keywords(Ndx), "")
Next Ndx
Next Rng
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default VBA - Code failing in Excel 97

Scott,

Off the top of my head, I think it's "Substitute" in 97.

hth,

Doug


"Scott Wagner" wrote in message
...
The following code is failing when users run in excel 97 on the "Replace"
item.

Can you help?

Thanks in advance,

Scott

'----------------------------------------------------
'Remove unneeded text in column G
'----------------------------------------------------
Range("G2:G2000").Select
Dim Keywords As Variant
Dim Rng As Range
Dim Ndx As Long
Keywords = Array("Q Line ", "120 VAC ", "- Breaker ", " Standard")
For Each Rng In Selection.Cells
For Ndx = LBound(Keywords) To UBound(Keywords)
Rng.Value = Replace(Rng.Text, Keywords(Ndx), "")
Next Ndx
Next Rng



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA - Code failing in Excel 97

Replace was added in xl2k.

In xl97, you could use application.substitute().



Scott Wagner wrote:

The following code is failing when users run in excel 97 on the "Replace" item.

Can you help?

Thanks in advance,

Scott

'----------------------------------------------------
'Remove unneeded text in column G
'----------------------------------------------------
Range("G2:G2000").Select
Dim Keywords As Variant
Dim Rng As Range
Dim Ndx As Long
Keywords = Array("Q Line ", "120 VAC ", "- Breaker ", " Standard")
For Each Rng In Selection.Cells
For Ndx = LBound(Keywords) To UBound(Keywords)
Rng.Value = Replace(Rng.Text, Keywords(Ndx), "")
Next Ndx
Next Rng


--

Dave Peterson
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
code failing in hidden rows RobN[_2_] Excel Discussion (Misc queries) 16 January 16th 08 02:19 AM
Keyboards Shortcuts in Excel 2002 Failing to Work Tapioca Excel Discussion (Misc queries) 4 September 4th 07 03:32 AM
Excel Macro Security Failing JayCl Excel Discussion (Misc queries) 0 September 28th 06 04:11 PM
Excel Copy Method Failing. [email protected] Excel Programming 2 May 11th 05 06:01 PM
Excel 2000 Macro failing in Excel 2002 Travis Excel Programming 1 August 6th 04 09:25 AM


All times are GMT +1. The time now is 06:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"