variables and for next statements

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I currently have this code

ME.WD_FULL_HRS.VISIBLE = TRUE

ME.TX_FULL_HRS.VISIBLE = TRUE

ME.ITAG_FULL_HRS.VISIBLE = TRUE

there are many more fields of the same naming convention.

Ok, what I would like to do is:

For Each GRP in ("WD","TX","ITAG")
FHRS = "ME." & GRP & "_FULL_HRS"
EXIT FOR
NEXT

FHRS.VISIBLE = TRUE

Is this possible?
 
Biggles said:
I currently have this code

ME.WD_FULL_HRS.VISIBLE = TRUE

ME.TX_FULL_HRS.VISIBLE = TRUE

ME.ITAG_FULL_HRS.VISIBLE = TRUE

there are many more fields of the same naming convention.

Ok, what I would like to do is:

For Each GRP in ("WD","TX","ITAG")
FHRS = "ME." & GRP & "_FULL_HRS"
EXIT FOR
NEXT

FHRS.VISIBLE = TRUE


Dim Itm As Variant
Dim Grp As Variant
For Each Itm IN Array("_FULL_HRS", . . .)
For Each Grp In Array("WD", "TX", "ITAG")
Me(Grp & Itm).Visible = True
Next Grp
Next Itm
 
Back
Top