PDA

View Full Version : Not specified issue



nikki333
06-29-2018, 02:31 PM
Hi Folks

So, I've got this so-called matrix to with some products in the rows and the exactly the same products in the columns; in order to see which tasks are to perform when changing from product1 to product2.

To give an example: 22499

For this i'm going through some arrays...In the end, an entry in the matrix could be "", a number (eg. 5-11), or a number combined with a or b (eg. 5a, 5b, ...)
, or multiple values separated by "," which is where the problem is.
My aim is to show any Xa or X number as bold, whereas Xb numbers should not become bold. The code works for that, except that the commas in between become bold as well,
but only when bold comes first, the other way is fine

here a "short" insight:

22500

For i = LBound(arrVariantenSplit) To UBound(arrVariantenSplit)

arrVarianten(i + 1, 1) = .Text eg. "10b"
arrVarianten(i + 1, 2) = arrVariantenSplit(i) eg. "10b"
arrVarianten(i + 1, 3) = Len(arrVariantenSplit(i)) eg. 3

If Not UBound(arrVariantenSplit) = 0 Then
arrVarianten(i + 1, 4) = InStr(1, arrVarianten(i + 1, 1), arrVarianten(i + 1, 2), 0) eg. 1
Else
arrVarianten(i + 1, 4) = 1
End If

If Right(arrVariantenSplit(i), 1) = "b" Then
arrVarianten(i + 1, 5) = Right(arrVariantenSplit(i), 1)
ElseIf Right(arrVariantenSplit(i), 1) = "a" Then
arrVarianten(i + 1, 5) = "a"
Else
arrVarianten(i + 1, 5) = 0
End If

If arrVarianten(i + 1, 5) = "a" Or arrVarianten(i + 1, 5) = 0 Then

With .Characters(arrVarianten(i + 1, 4), arrVarianten(i + 1, 3)).Font eg. so here it should apply bold to characters 1-2 or 1-3 only
.Bold = True: .Size = 11
End With

Else

With .Characters(arrVarianten(i + 1, 4), arrVarianten(i + 1, 3)).Font
.Bold = False: .Size = 10: .Color = RGB(89, 89, 89)
End With

End If

Next i

p45cal
06-29-2018, 03:59 PM
I think we might need to know what's in and how the values in arrVariantenSplit have been assigned.

Paul_Hossler
06-29-2018, 04:12 PM
Not much to go on but maybe





arrVarianten(i + 1, 1) = .Text eg. "10b"
arrVarianten(i + 1, 2) = arrVariantenSplit(i) eg. "10b"


If Right(arrVarianten(i + 1, 1),1) = "," Then


arrVarianten(i + 1, 3) = Len(arrVariantenSplit(i))-1
Else
arrVarianten(i + 1, 3) = Len(arrVariantenSplit(i)) eg. 3
End if