我有两个表(ErrorSummary和VolumeSummary)描述了我整个团队的一些变量。这些表具有相同的行数,因为每个行标题是一个雇员的名称。还有一些附属图表连接到数据。
我想在工作表顶部创建4个搜索字段,以便用户可以同时比较4名员工的数据。
我试图对此进行编码,但这就是被绊倒的行:
'Filtered Data Range (include column heading cells)
Set DataRange = sht.Range("A41:O72") 'Cell Range
'Retrieve User's Search Input
mySearch = sht.Shapes ("staff1""staff2""staff3""staff4").TextFrame.Characters.Text 'Control Form
^用户搜索输入行。我试图让它逐一引用所有的形状。这可能吗?
提前致谢。
答案 0 :(得分:0)
试试这个:
'Filtered Data Range (include column heading cells)
Set DataRange = sht.Range("A41:O72") 'Cell Range
'Retrieve User's Search Input
mySearch = sht.Shapes("staff1").TextFrame.Characters.Text 'Control Form
mySearch = mySearch & " " & sht.Shapes("staff2").TextFrame.Characters.Text
mySearch = mySearch & " " & sht.Shapes("staff3").TextFrame.Characters.Text
mySearch = mySearch & " " & sht.Shapes("staff4").TextFrame.Characters.Text
这将使mysearch
成为一个字符串,其中包含来自所有四个形状的文本,每个形状之间都有一个空格。