Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
modifying code troubles | Excel Programming | |||
COM Add-in Troubles | Excel Discussion (Misc queries) | |||
IF troubles | Excel Worksheet Functions | |||
Code Troubles | Excel Programming | |||
Troubles opening a CSV file from code | Excel Programming |