#### Hybrid View

Just one more quick question and then I will go away for a while

I have 3 conditions, call them boxes a,b and c.
Box A is a number between 6 and 8
Box B is a number between 0 and 10
Box C is either Y or N

Depending on the results of these 3 cells a vaue is taken from a table.
Short of saying If Cells(3, 32) = 6 or 7 or 8" etc, is there are number between function?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(3, 32) = ""Number between 6 & 8""And Cells(7, 32) = number between 0 and 10 And Cells(9, 32) = "N" Then
Cells(50, 21) = Cells(3, 5)

End If

2. ## Re: Just one more question :)

Code:
```Sub between()
Dim firstCondition As Boolean
Dim secondcondition As Boolean
If Cells(3, 3) > 6 And Cells(3, 3) < 8 Then
firstCondition = True
End If
If Cells(4, 3) > 0 And Cells(4, 3) < 10 Then
secondcondition = True
End If
If firstCondition And secondcondition Then
MsgBox "Both are true"
End If
End Sub```

3. ## Re: Just one more question :)

Thanks, but not quite what I am after.

Attached is the page I am messing with and shows what I am trying to achieve with your help.

4. ## Re: Just one more question :)

Steve,

I looked at the file, and I'm not real clear on what you are doing (or trying to do). I'm not sure how the "matrices" fit with your conditions and logic.

Maybe try explaining one more time, in laymen's terms?

5. ## Re: Just one more question :)

There are three variables that can be entered, line size, length and Y or N to INS. These variables would eventually come from another page in the workbook which I would create, something like a summary page. Currently, all this info (and a lot of other stuff) is on different files and I am trying to put it all in 1 file and "automate" it so that with minimal data entry it will populate as much as I can work out how to do without having to keep jumping between files. This same basic method which is created for this would be adapted to use with other data sheets with similar data.

What I hope to achieve is to have the final entry (at bottom of page) to appear automatically depending on what combination of the 3 variables I use, rather than manually looking thru the table and picking out the relevant number.
i.e. Size = 6
Length = 47
INS = Y would show value 2821
or
Size = 20
Length = 23
INS = N would show value 4015

This picks the number that matches these variables from the table on the page.

Hope this is a bit clearer on what I am trying to get to..........thanks

6. ## Re: Just one more question :)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Cells(3, 32) >= 6 <= 8 Then
If Cells(6, 32) >= 0 <= 10 Then
If Cells(9, 32) = N Then
Cells(50, 21) = Cells(3, 5)
End If
End

Should it be something like this??

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•