Hi,
In a file I am working on I have to add 2 information (which is selected from 2 lists) to a given event name (1 text information before the event name and 1 text information after the event name) and display it in a cell.
For example:
Event name - Christmas
1st information - Schools
2nd information - Parents
The entire text which is supposed to be displayed is: '[Sch]: Christmas - Prnt'
My code looks like this:
If UCase(e.Cells(xee, 5).Value) = "SCHOOLS" And UCase(e.Cells(xee, 10).Value) = "PARENTS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value & " - [Prnt]"
The problem is I have many options in those 2 lists so there are a lot of combinations. I can duplicate this code and add each combination, but I'm afraid the code will be way too long and the procedure will become too large (and error).
Example:
ElseIf UCase(e.Cells(xee, 5).Value) = "SCHOOLS" And UCase(e.Cells(xee, 10).Value) = "TEACHERS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value & " - [Tch]"
ElseIf UCase(e.Cells(xee, 5).Value) = "COLLEGE" And UCase(e.Cells(xee, 10).Value) = "TEACHERS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Coll]: " & e.Cells(xee, 3).Value & " - [Tch]"
ElseIf UCase(e.Cells(xee, 5).Value) = "COLLEGE" And UCase(e.Cells(xee, 10).Value) = "PARENTS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Coll]: " & e.Cells(xee, 3).Value & " - [Prnt]"
...and so on.
Is there a more simple way to do this?
Thanks in advance!
In a file I am working on I have to add 2 information (which is selected from 2 lists) to a given event name (1 text information before the event name and 1 text information after the event name) and display it in a cell.
For example:
Event name - Christmas
1st information - Schools
2nd information - Parents
The entire text which is supposed to be displayed is: '[Sch]: Christmas - Prnt'
My code looks like this:
If UCase(e.Cells(xee, 5).Value) = "SCHOOLS" And UCase(e.Cells(xee, 10).Value) = "PARENTS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value & " - [Prnt]"
The problem is I have many options in those 2 lists so there are a lot of combinations. I can duplicate this code and add each combination, but I'm afraid the code will be way too long and the procedure will become too large (and error).
Example:
ElseIf UCase(e.Cells(xee, 5).Value) = "SCHOOLS" And UCase(e.Cells(xee, 10).Value) = "TEACHERS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Sch]: " & e.Cells(xee, 3).Value & " - [Tch]"
ElseIf UCase(e.Cells(xee, 5).Value) = "COLLEGE" And UCase(e.Cells(xee, 10).Value) = "TEACHERS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Coll]: " & e.Cells(xee, 3).Value & " - [Tch]"
ElseIf UCase(e.Cells(xee, 5).Value) = "COLLEGE" And UCase(e.Cells(xee, 10).Value) = "PARENTS" Then
o.Cells((6 * (j - 1) + q), 6).Formula = "[Coll]: " & e.Cells(xee, 3).Value & " - [Prnt]"
...and so on.
Is there a more simple way to do this?
Thanks in advance!