Can anyone simplify this code it looks for a file with YES next to it and then uses that file later down the code

bdouglas1011

New Member
Joined
Jul 28, 2014
Messages
38
This code looks at 2 columns 1 column has files listed from a folder the next column one of the files will has "YES" in it ...so the code selects the file that is to the left of the YES

The range with file names is (CC30:CC43)other rows from the path cell. The column that has the yes in it is Range (CL30:CL43)

tried getting rid of the col & row parts but could not make it work

VBA Code:
path = cells(i + 30, 81)

    'If Right(path, 1) <> "\" Then path = path + "\"  

    'setting up the generic name for unformatted surveys, "path\<Well Name> Surveys.csv"

    Dim unformatSvy As String: unformatSvy = path + Range("G10").Text + " Surveys.csv"  

    'Find the file marked as the survey file then exit loop

    For i = row + 2 To row + 15

        If cells(i, col + 11).Value = "Yes" Then

            path = path + cells(i, col + 2).Text

            Exit For

        End If

    Next i
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top