kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
I think I have some issues with my code which is not giving me the exact outcome I am looking for (independent of what I asked before).
This is how I am implementing the code in my workbook:
Inside the CmbAss1 combobox, I will be making a selection which could be any of the 4:
20-80
30-70
40-60
50-50
Then I had the split function to split and take the first part as shown with my case statement above.
I will be looping through 10 columns. And in each column, I wanna check if there is a number which does not fall with the ConvPer value.
This part of the code:
Is something I found on the web – I don’t really understand it and I am thinking I failed to tweak it to my needs. Is there something I am not able to spot?
Thanks in advance.
This is how I am implementing the code in my workbook:
Code:
If Len(CmbAss1) Then
ConvPercent = Split(CmbAss1, "-")
ConvPer = Val(ConvPercent(0))
Select Case ConvPer
Case 20: strName() = [transpose(row(1:20))]
Case 30: strName() = [transpose(row(1:30))]
Case 40: strName() = [transpose(row(1:40))]
Case 50: strName() = [transpose(row(1:50))]
End Select
For i = 0 To 9
For Each cScore In sh.Range("I7:I" & lr).Offset(, i).Cells
If cScore <> "" Then
strFind = Val(cScore)
For j = LBound(strName, 1) To UBound(strName, 1)
If InStr(strName(j), strFind) = 0 Then
MsgBox "Sorry, " & cScore & ", is outside your selection", vbExclamation, ""
CmbAss1 = ""
Exit Sub
End If
Next j
End If
Next cScore
Next i
End If
Inside the CmbAss1 combobox, I will be making a selection which could be any of the 4:
20-80
30-70
40-60
50-50
Then I had the split function to split and take the first part as shown with my case statement above.
I will be looping through 10 columns. And in each column, I wanna check if there is a number which does not fall with the ConvPer value.
This part of the code:
Code:
For j = LBound(strName, 1) To UBound(strName, 1)
If InStr(strName(j), strFind) = 0 Then
MsgBox "Sorry, " & cScore & ", is outside your selection", vbExclamation, ""
CmbAss1 = ""
Exit Sub
End If
Next j
Thanks in advance.