返回列表 上一主題 發帖

如何使 TextBox3.Text 為一個 TextBox(i).Text 來使用

如何使 TextBox3.Text 為一個 TextBox(i).Text 來使用

請教各位大大:
VBA中表單內某 Sub
    For i = 2 To lastrow1
            If Cells(i, 4) = TextName.Text Then
                TextBox3.Text = Sheets("學生資料").Cells(i, 6)
                TextBox4.Text = Sheets("學生資料").Cells(i, 7)
                TextBox5.Text = Sheets("學生資料").Cells(i, 8)
                TextBox6.Text = Sheets("學生資料").Cells(i, 9)
           endif
      next
      loop中  當找到第二個 Cells(i, 4)
       應如何使  Sheets("學生資料").Cells(i, 6)填入 TextBox7.Text
       也就是說如何使   TextBox3.Text  為一個  TextBox(i).Text  來使用
謝謝協助

謝謝GBKEE
   我的TextBox有80個
     陣列 Ar = Array(TextBox3, TextBox4, TextBox5....)
       是否一定要寫至TextBox80?
   Ar 設定語法
      Dim ar(80)  as  string   是否正確 需要
      或是 只要
      set  Ar = Array(TextBox3, TextBox4, TextBox5....)
         或是 只要
      Ar = Array(TextBox3, TextBox4, TextBox5....)

TOP

太棒了 ,完全解決。
   其他Controls應是可如法泡製才對
   GBKEE,et5323 謝謝你門

TOP

        靜思自在 : 一個人的快樂.不是因為他擁有得多,而是因為他計較得少。
返回列表 上一主題