LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA excel using arrays and loops

I would appreciate some help getting this array of strings and replace
function working. All I need it to do is loop through the array and
replace COM, LS, ARTS in the worksheet.

I know my problem lies with how to feed the sub_replace variable into
the function but I cannot figure out how to do it, any help would be
greatly appreciated.

Sub array_test()

Dim sub_replace(1 To 7) As String
Dim i As Integer

sub_replace(1) = "COM"
sub_replace(2) = "LS"
sub_replace(3) = "DN"
sub_replace(4) = "ARTS"
sub_replace(5) = "PS"
sub_replace(6) = "IS"
sub_replace(7) = "AL"

For i = 1 To 7
If i < 8 Then
Selection.Replace What:=(sub_replace(i)), Replacement:="",
LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False
i = i + 1
Else
MsgBox "finished cleanup"
End If
Next i

End Sub

 
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
if function in excel should 12 loops Madhukar Excel Discussion (Misc queries) 2 September 7th 06 01:30 PM
Excel macro/vba loops sammy Excel Programming 1 February 15th 05 05:09 PM
Scope of the arrays in Loops itsmaheshp[_9_] Excel Programming 1 November 15th 04 12:51 PM
Arrays to replace very slow loops ? vbastarter Excel Programming 5 August 10th 04 07:15 PM
excel 97: if then and for next loops help JMCN Excel Programming 2 November 10th 03 02:24 PM


All times are GMT +1. The time now is 09:39 PM.

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"