Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 确定哪个页面文本框在多页上有文本(已解决)_Excel_Vba - Fatal编程技术网

Excel 确定哪个页面文本框在多页上有文本(已解决)

Excel 确定哪个页面文本框在多页上有文本(已解决),excel,vba,Excel,Vba,是否可以确定文本框在哪些页面上有任何值? 以及获取非空文本框选项卡的名称。 设置: 在第1页文本框1上,在第2页文本框2上。 如果TextBox2的值为init,我需要获取页面的名称 提前谢谢 到目前为止,我尝试的是从特定的文本框中获取值 a = "" Dim r As Integer For r = 5 To 12 If step_0.Controls("TextBox" & r).Value <> ""



是否可以确定文本框在哪些页面上有任何值?
以及获取非空文本框选项卡的名称。

设置:
在第1页文本框1上,在第2页文本框2上。
如果TextBox2的值为init,我需要获取页面的名称
提前谢谢

到目前为止,我尝试的是从特定的文本框中获取值

a = ""
Dim r As Integer
For r = 5 To 12
    If step_0.Controls("TextBox" & r).Value <> "" Then
    a = a & " " & step_0.MultiPage1.Pages(r - 5).Caption
    End If
Next
a=“”
作为整数的Dim r
对于r=5到12
如果步骤0.控制(“文本框”&r).Value“”,则
a=a&&&step\u 0.MultiPage1.Pages(r-5)。标题
如果结束
下一个

最后我成功了,这对我来说很有效。

所以经过一点思考,我找到了这个解决方案。
如果您想使用多页标题和文本框,这将非常方便。
代码:

a = ""
Dim r As Integer
For r = 5 To 12
'according to count of textboxes should be 1 to whatever
    If UserForm1.Controls("TextBox" & r).Value <> "" Then
    a = a & " " & UserForm1.MultiPage1.Pages(r - 5).Caption
'since the first page index is 0, subtract the integer. It only works if they arranged like this:
'page0-tbox1,page1-tbox2 page_n-tbox_n+1....
'a= creates a list with the captions of pages which has fulfilled textboxes.
    End If
Next
a=“”
作为整数的Dim r
对于r=5到12
'根据文本框的计数,应该是1到任意值
如果UserForm1.Controls(“TextBox”&r.Value”),则
a=a&&&UserForm1.MultiPage1.Pages(r-5)。标题
'因为第一页索引是0,所以减去整数。只有当他们这样安排时,它才会起作用:
'第0-tbox1页,第1-tbox2页\n-tbox\n+1。。。。
'a=创建一个列表,其中包含已完成文本框的页面标题。
如果结束
下一个

这不是免费的编码服务。到目前为止你试过什么?请包括您的代码,并解释您在哪里被卡住或出现错误。代码已添加,先生!请注意,如果您自己找到了解决方案,您应该将其作为答案发布。1天后,您应该能够将自己的anwser标记为问题的正式解决方案。