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: 852
Default Array code troubles

With the three sheets in the array, find the text "DEPR-GENERATORS" in columb B and with the next five rows below "DEPR-GENERATORS", preceed the text in those cells with the text "DEPR".

This code finds the "DEPR-GENERATORS" in columb B and preceeds the five rows each with 3 "DEPR"'s and only on Sheet1.

A sample row before and after code runs:

-COMPUTER EQUIP

and after:

DEPRDEPRDEPR-COMPUTER EQUIP

And only runs on sheet 1.

Thanks.
Howard

Sub AFindIt()

Dim i As Long, ii As Long
Dim MyArr As Variant

MyArr = Array("Sheet1", "Sheet2", "Sheet3")

Application.ScreenUpdating = False

For i = LBound(MyArr) To UBound(MyArr)

With MyArr(i)

' "DEPR-GENERATORS" will be in Column B1:Bn
Cells.Find(What:="DEPR-GENERATORS", After:=ActiveCell, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate

' Put DEPR in front of the text in the next 5 rows below found text "DEPR-GENERATORS"
For ii = 1 To 5
ActiveCell.Offset(ii) = "DEPR" & Trim(ActiveCell.Offset(ii))
Next ' ii

End With 'MyArr(i)
Next 'i
Application.ScreenUpdating = True
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
modifying code troubles Carlee Excel Programming 1 May 30th 07 05:58 PM
COM Add-in Troubles Howard Excel Discussion (Misc queries) 0 May 22nd 07 01:59 PM
IF troubles JG Excel Worksheet Functions 6 December 24th 06 04:58 AM
Code Troubles merritts[_13_] Excel Programming 4 July 27th 06 07:17 PM
Troubles opening a CSV file from code Bas van Dijk Excel Programming 0 January 19th 04 01:21 PM


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