View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Loop through a range Open a file

Try code like the following

Dim R As Range
For Each R In Range("AA3:AA33").Cells
If StrComp(R.Text, "yes", vbTextCompare) = 0 Then
Workbooks.Open Filename:=MyPath & "\" & _
R.EntireRow.Cells(1, "A").Text
End If
Next R


Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Thu, 18 Mar 2010 08:11:02 -0700, Thanks
wrote:

Hello
I have a range AA3:AA:33 that contains either "yes" or "no". and a list of
files (myfile.csv) in A3:A33 I would like to loop through the range AA3:AA33
and if the value is yes open the coresponding file in column A. The path to
the file is previously determined by code to be MyPath.
Thanks