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: 246
Default Loop thru Range Help needed

I have code with an input box that works as expected .Instead of the
input box I would like to loop through the projects, which are defined
in column "A" of the active sheet starting at Row 5. The projects are
defined by the left (6) characters in "A". The expected result would be
the activeworkbook filled with the detail sheet from each project
listed in "A". Need help. TIA

For example column data:


05-001-000-000-000
06-001-000-000-000 etc.


Projects are 05-001 and 06-001. The code:


Sub Copy340WIP()
Dim WBwip As Workbook
Dim WB2 As Workbook


Set WB2 = ActiveWorkbook


On Error Resume Next
Set WBwip = Workbooks("RF 340-000.xls")
On Error GoTo 0
If WBwip Is Nothing Then
ChDir "S:\FIN\Finance\Capital Projects\WIP Detail"
Workbooks.Open filename:= _
"S:\FIN\Finance\Capital Projects\WIP Detail\RF 340-000.xls"
Else
'already open
End If


WBwip.Sheets("340-000-900 Pivot Table").Activate


Call FindStr("Proj")


Selection.ShowDetail = True


ActiveSheet.Move After:=WB2.Worksheets(WB2.Worksheets.Count)


Application.DisplayAlerts = True


End Sub


Function FindStr(FindProj As String) As String
Dim frng As Range


FindProj = InputBox("Enter Project Number, such as 00-000", "Enter
Project Number", "06-012") <<<<<<<REPLACE THIS WITH PROJECT ARRAY


Set frng = Cells.Find(what:=FindProj, LookIn:=xlFormulas,
lookat:=xlPart)
If Not frng Is Nothing Then
FindStr = frng.Offset(0, 9).Address(1, 1, xlA1)
Else
MsgBox ("Proj, not found")
End If
frng.Offset(0, 9).Activate


End Function


Greg

 
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
simple loop needed please Alan Excel Discussion (Misc queries) 1 May 5th 10 06:33 PM
Add a Range to an existing Range in a loop? Mick Excel Programming 3 June 18th 05 06:12 AM
loop code needed JohnUK Excel Programming 1 June 14th 05 05:17 AM
Urgent Help needed on! Copy and Paste a Formula as Values using a Loop statement Edward S Excel Programming 4 June 26th 04 10:01 PM
help needed with timer / loop wendy_ia Excel Programming 0 June 17th 04 06:06 AM


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