Hi
I have the following code which puts default values into some textboxes in a userform. I have repeated this code several times within my project. As you can see the text box names change from p1 through to p12. I have tried using a for next loop from 1 to 12 to try to make my code more efficient but not exactly sure how to do this.
Thanks
Harv
I have the following code which puts default values into some textboxes in a userform. I have repeated this code several times within my project. As you can see the text box names change from p1 through to p12. I have tried using a for next loop from 1 to 12 to try to make my code more efficient but not exactly sure how to do this.
Thanks
Harv
Code:
RevPhasing.p1phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("e12")), 1)
RevPhasing.p2phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("f12")), 1)
RevPhasing.p3phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("g12")), 1)
RevPhasing.p4phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("h12")), 1)
RevPhasing.p5phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("i12")), 1)
RevPhasing.p6phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("j12")), 1)
RevPhasing.p7phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("k12")), 1)
RevPhasing.p8phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("l12")), 1)
RevPhasing.p9phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("m12")), 1)
RevPhasing.p10phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("n12")), 1)
RevPhasing.p11phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("o12")), 1)
RevPhasing.p12phase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("p12")), 1)
RevPhasing.totalphase0405.Text = FormatPercent(Val(Sheets("Revenue").Range("r12")), 1)