0

I am trying to retrieve value from a textbox dynamically.

This code isn't working.

For i = 1 To TotalSheets

    ReqValue = ValidationForm.Frame6.ReportName(i).Value


Next

But this code does,

ReqValue = ValidationForm.Frame6.ReportName1.Value

I need to get the values dynamically through a loop.

2
  • What is your ValidationForm? A UserForm or something hand crafted using Form controls and / or ActiveX controls? Commented Jan 19, 2018 at 11:32
  • @AlexP It's an userform but those textboxes are created dynamically using vba code. Commented Jan 19, 2018 at 11:34

1 Answer 1

3

Reportname(i) refers to an array.

Instead, you have to concatenate the name of your control:

ValidationForm.Frame6.Controls(“ReportName” & i).Value
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.