ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¦p¦ó¨Ï TextBox3.Text ¬°¤@­Ó TextBox(i).Text ¨Ó¨Ï¥Î

¦p¦ó¨Ï TextBox3.Text ¬°¤@­Ó TextBox(i).Text ¨Ó¨Ï¥Î

½Ð±Ð¦U¦ì¤j¤j:
VBA¤¤ªí³æ¤º¬Y 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¤¤  ·í§ä¨ì²Ä¤G­Ó Cells(i, 4)
       À³¦p¦ó¨Ï  Sheets("¾Ç¥Í¸ê®Æ").Cells(i, 6)¶ñ¤J TextBox7.Text
       ¤]´N¬O»¡¦p¦ó¨Ï   TextBox3.Text  ¬°¤@­Ó  TextBox(i).Text  ¨Ó¨Ï¥Î
ÁÂÁ¨ó§U

¦^´_ 1# yangjie
¨Ï¥Î°}¦C Ar = Array(TextBox3, TextBox4, TextBox5....)
For i = 2 To lastrow1
        If Cells(i, 4) = TextName.Text Then
            For ii = 0 To UBound(AR)
                AR(ii).Value = Sheets("¾Ç¥Í¸ê®Æ").Cells(i, 6 + ii)
            Next
        End If
Next

TOP

ÁÂÁÂGBKEE
   §ÚªºTextBox¦³80­Ó
     °}¦C Ar = Array(TextBox3, TextBox4, TextBox5....)
       ¬O§_¤@©w­n¼g¦ÜTextBox80¡H
   Ar ³]©w»yªk
      Dim ar(80)  as  string   ¬O§_¥¿½T »Ý­n
      ©Î¬O ¥u­n
      set  Ar = Array(TextBox3, TextBox4, TextBox5....)
         ©Î¬O ¥u­n
      Ar = Array(TextBox3, TextBox4, TextBox5....)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2010-10-7 11:17 ½s¿è

¦^´_ 3# yangjie
Dim Ar(3 To 80) As MSForms.Control, i%
For i = 3 To 80
  Set Ar(i) = Controls("TextBox" & i)
Next
For i = 2 To lastrow1
        If Cells(i, 4) = TextName.Text Then
            For ii = 3 To UBound(AR)
                AR(ii).Value = Sheets("¾Ç¥Í¸ê®Æ").Cells(i, 6 + ii - 3)
            Next
        End If
Next
¸É¤W¥t¤@¸Ñªk
For i = 2 To lastrow1
    If Cells(i, 4) = TextName.Text Then
        For ii = 3 To 80
            Controls("TextBox" & ii) = Sheets("¾Ç¥Í¸ê®Æ").Cells(i, 6 + ii - 3)
        Next
    End If
Next

TOP

¦A简¤Æ点:
Dim  i%,ii%
For i = 2 To lastrow1
        If Cells(i, 4) = TextName.Text Then
            For ii = 3 To 80
                Controls("TextBox" & ii).object.Value = Sheets("¾Ç¥Í¸ê®Æ").Cells(i, 6 + ii - 3)
            Next
        End If
Next

TOP

¤Ó´Î¤F ¡A§¹¥þ¸Ñ¨M¡C
   ¨ä¥LControlsÀ³¬O¥i¦pªkªw»s¤~¹ï
   GBKEE¡Aet5323 ÁÂÁ§Aªù

TOP

¦^´_ 4# GBKEE


    Dear G¤j¤j & ¦U¦ì¤j¤j

     ¤p§Ì¹ï±±¨î¶µ(¦p:listbox,textbox.label)ªºÀ³¥Î~ ·Q½Ð±z«ü¾É¤@¤U~
     ­Y¬O§Úªºdata¬ONµ§ (¨C¦¸¤@§ó·s¼Æ¶q¤£¤@)
     §Ú­n¦p¦ó¦bUserForm¤¤²£¥Í¬Û¹ïÀ³ªºLabel
     
      ex.
      sheet1   A1:A10  Àx¦s®æªº­È¬°A~J
      SHEET1 ¤¤¦³¹w³]¤@­ÓCommandButton1 ÂI¿ï«á·|¸õ¥X¤@­ÓUserForm1
      ¨Ã¦Û¦æ²£¥Í10­ÓLabel
      Label1.Caption=A
      Label2.Caption=B
      .
      .
      Label1.Caption=J
      
      ¦bVBA¤¤¬O§_¥i¥H°µ¨ì³o¼Ëªº¥\¯à~ ¦³ÂI°ÊºAªºÅã¥Ü~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¥»©«³Ì«á¥Ñ oobird ©ó 2012-3-5 12:45 ½s¿è
  1. Private Sub UserForm_Initialize()
  2.     rng = Range([a1], [A65536].End(3))
  3.     For i = 1 To UBound(rng)
  4.         Set b = Me.Controls.Add("Forms.Label.1")
  5.         With b
  6.             .Height = 10
  7.             .Width = 10
  8.             .Top = 15 * i
  9.             .Left = 20
  10.             .Caption = rng(i, 1)
  11.         End With
  12.     Next
  13. End Sub
½Æ»s¥N½X

TOP

¦^´_ 8# oobird

     ÁÂÁÂo¤j¤jªº±Ð¾É~
     §Ú¥ç±N¨ä­×§ï¦¨
     ­Yuserform1¤¤ªºlabel ¨C¤@±Æ15¦C ¨Ó±Æ¦C
     sheet1ªº¸ê®Æ=>¥Î¨Ó§PÂ_label¦@»Ý­n±Æ´X¦C
     ²Ä¤@¶¥¬q¤w¸g¥i¥H¨Ìsheet1ªºdata =userform1¤¤ªºlabel.caption
     ¥ç¦P®É·s¼Wtextbox
     
    ¦AÄ~Äò©µ¦ù¤@­Ó°ÝÃD( ¦p¦ó¦A±Nuserform1¤¤ªºlabel & textbox¦s¨ìsheet2)
     ­Y¦buserform1 ¹w³]¤@­Ócommandbutton1 ±Nuserform1¤¤label & textboxªº¸ê®Æ
    §ì¨ú¨ìsheet2
    sheet2.AÄæ ¦s©ñuserform1.label
    sheet2.BÄæ ¦s©ñuserform1.textbox
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

        ÀR«ä¦Û¦b : §g¤l¬°¥Ø¼Ð¡A¤p¤H¬°¥Øªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD