• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Failure to to data validation to another range

Eric Carolus

New Member
Goo day folks
I have trouble copying data validation from one range to another.

In the workbook (attached) are two sheets, Daily_Periods and
Three_Teachers. On the sheet Daily_Periods, the data validation works just fine.
I managed to copy the data validation from F7:F24 to O7:O24 (and other ranges).

I tried to do the same on the sheet Three_Teachers, meaning the data validation works on
the range I5:I24 BUT copying the data validation to L5:L25 and O5:O25 does not work.
I need some help here please.

Thanks in advance folks

Crow
 

Attachments

  • Forum.xlsm
    145.3 KB · Views: 3
It's because of this section.
Code:
            If InStr(1, Target.Offset(, -5), "Period", 1) Then

                p = Replace(Target.Offset(, -5), "Period ", "")

Offset from Target is hard coded as -5. This must be made dynamic depending on which Teacher column it is.

Or rather, you need to always look in "D" column using Target's row.

Change it to something like...

Code:
            If InStr(1, Cells(Target.Row, "D"), "Period", 1) Then

                p = Replace(Cells(Target.Row, "D"), "Period ", "")
 
Back
Top