Dear reader(s),
I apologise for the title of this thread, but I couldn't define it different. My problem is that I want to use a variable which has to be "variable".
Dim tempProdGroup As Variant
tempProdGroup = Report_ProdForm.lstProdGroup.ListCount
For prodGroupCtr = 0 To tempProdGroup
tempGrpVal = Report_ProdForm.lstProdGroup.ItemData(prodGroupCtr)
If tempGrpVal = "Unit" Then
ln1ProdGroup(prodGroupCtr).Visible = True
Else
ln2ProdGroup(prodGroupCtr).Visible = True
End If
Next
End Sub
My problem is in the If - Else - End If part: I would like to use the variable prodGroupCtr to check which line has to become visible. I have defined ln1ProdGroup1 through ln1ProdGroup19 and ln2ProdGroup1 through ln2ProdGroup19.
Can this be done with a a concatenated string like
ln1ProdGroup(prodGrpCtr).Visible = True
(but then in a right way of VBA programming ) or has this be done completely different?
Thanks in advance,
Jochen. --------------------------------------------------------------------------------
It never hurts to help and it never helps to hurt.
I apologise for the title of this thread, but I couldn't define it different. My problem is that I want to use a variable which has to be "variable".
Dim tempProdGroup As Variant
tempProdGroup = Report_ProdForm.lstProdGroup.ListCount
For prodGroupCtr = 0 To tempProdGroup
tempGrpVal = Report_ProdForm.lstProdGroup.ItemData(prodGroupCtr)
If tempGrpVal = "Unit" Then
ln1ProdGroup(prodGroupCtr).Visible = True
Else
ln2ProdGroup(prodGroupCtr).Visible = True
End If
Next
End Sub
My problem is in the If - Else - End If part: I would like to use the variable prodGroupCtr to check which line has to become visible. I have defined ln1ProdGroup1 through ln1ProdGroup19 and ln2ProdGroup1 through ln2ProdGroup19.
Can this be done with a a concatenated string like
ln1ProdGroup(prodGrpCtr).Visible = True
(but then in a right way of VBA programming ) or has this be done completely different?
Thanks in advance,
Jochen. --------------------------------------------------------------------------------
It never hurts to help and it never helps to hurt.