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

[µo°Ý] comBobox¦p¦ó¦P®É¤]¯à¨ú¥X¤wÅܧó©w¸q«áªº°Ñ·Ó½d³ò©O¡H

[µo°Ý] comBobox¦p¦ó¦P®É¤]¯à¨ú¥X¤wÅܧó©w¸q«áªº°Ñ·Ó½d³ò©O¡H

¦U¦ì¤j¤j¦n¡G

  ¦³¤@MULTIPAGEªí³æ¡A¨ä¦WºÙ¬°
­û¤u°ò¥»¸ê®Æ¡C¨Ã°t¦³comBobox6
¨ä¥Î³~¬°¨Ñ¨Ï¥ÎªÌ¥i¿ï¨ú­û¤u©m¦W¤§¥Î¡C

  ²{¤p§Ì¤§°ÝÃD¬°¦b·s¼W­û¤u®É¡A¿ï¨ú¡§·s¼W¡¨«ö¶s
·s¼W­û¤u¡F¨Ã¦P®É³]¦³ª½±µÅܧó©w¸q¦WºÙ
ªº°Ñ·Ó½d³ò¡C¤§«á¿ï¨úcomBobox6µo²{¨ä¤ºªº°Ñ·Ó½d³ò
¨Ã¥¼§ïÅÜ¡F¨äµ²ªG¤]´NµLªk¨ú±o¤w·s¼Wªº
­û¤u©m¦W¡C½Ð°ÝcomBobox6À³¦p¦ó­×§ï¤~
¥i¦¨¥\¨ú±o¹ê»Ú°Ñ·Ó½d³ò©O¡H
¨ä»yªk¦p¤U¡G

Private Sub ComboBox6_Change()
    Dim mAr1 As Variant
    Dim mStr1$, mStr1a$
    Dim mSht1 As Worksheet
    Dim mRng1 As Range, mRng1a As Range
   
    Set mSht1 = Worksheets("­û¤u°ò¥»¸ê®Æ")
    mSht1.Select
   
    With mSht1
        
        Set mRng1 = Range("­û¤u°ò¥»¸ê®Æ")
        
        With mRng1
            
            mAr1 = mRng1.Offset(1, 1).Resize(.Rows.Count - 1, 1).Value
            mAr1 = WorksheetFunction.Transpose(mAr1)
            
            With ComboBox6
                .Width = .Width * 1
                .ColumnCount = 1
                .List = mAr1
                .Value = .List(.ListIndex)
                mStr1 = .Value
                '.SetFocus
            End With
        End With
        
        Set mRng1a = mRng1.Columns(2).Find(what:=mStr1, lookat:=xlWhole, searchorder:=xlByRows)
        If Not mRng1a Is Nothing Then
            
            'MsgBox mRng1a.Value
            TextBox1.Value = mRng1a.Offset(, -1).Value
            TextBox2.Value = mRng1a.Value
            TextBox3.Value = mRng1a.Offset(, 1).Value
            TextBox4.Value = mRng1a.Offset(, 2).Value
            TextBox5.Value = mRng1a.Offset(, 3).Value
            TextBox6.Value = mRng1a.Offset(, 4).Value
            TextBox7.Value = mRng1a.Offset(, 5).Value
            TextBox8.Value = mRng1a.Offset(, 7).Value
            
            mStr1a = mRng1a.Offset(, 6).Value         
            
            
            If mStr1a = "¦b¾" Then
                OptionButton1.Value = True
            ElseIf mStr1a = "Â÷¾" Then
                OptionButton2.Value = True
            End If            
                       
            mRng1a.Offset(, -1).Select            
        End If   
               
    End With
   
    Set mSht1 = Nothing
    Set mRng1 = Nothing
    Set mRng1a = Nothing   
   
End Sub

·P®¦¤j¤j¡I

mTest.rar (92.12 KB)

¥»©«³Ì«á¥Ñ GBKEE ©ó 2010-10-18 09:01 ½s¿è

¦^´_ 1# dechiuan999
°ÝÃD¦bPrivate Sub CommandButton5_Click()
           With Range("­û¤u°ò¥»¸ê®Æ")
            mStr1a = TextBox1.Text
            Set mRng1b = Range("­û¤u°ò¥»¸ê®Æ").Columns(1).Find(what:=mStr1a, lookat:=xlWhole, searchorder:=xlByRows)
            If Not mRng1b Is Nothing Then
                MsgBox "§A¿é¤Jªº­û¤u½s¸¹­«ÂÐ" & vbCrLf & vbCrLf & "½Ð­«·s¿é¤J­û¤u½s¸¹"
                Exit Sub
            End If
            mRow1 = Range("­û¤u°ò¥»¸ê®Æ").Rows.Count     '­pºâ¥X©w¸q¦WºÙªº¦C¼Æ
        If TypeName(Selection) = "Range" Then
                .Cells(1).End(xlDown).Offset(1).Select               '½Ð¥[¤J³o¤@¬q
                If Intersect(Selection, Range("­û¤u°ò¥»¸ê®Æ").End(xlDown).Offset(1)) Is Nothing Then
                          'MsgBox "½Ð¥ý¿ï¨ú¿é¤J¸ê®Æ«ü©w¦ì¸m"
                    Exit Sub
                Else
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''
CommandButton5_Click() ·s¼W¸ê®Æªº¨¾§b±¹¬I ¤Ö¤F©m¦Wªº¨¾§b
¨¾§b¤§«á  ·s¼W¸ê®Æª½±µ¥Î ¤£¥Î²z·|selectionªº¨Æ ¦p¤U
  1. Private Sub CommandButton5_Click()
  2.     Dim Sh As Worksheet, Rng As Range
  3.     Set Sh = Worksheets("­û¤u°ò¥»¸ê®Æ")
  4.     Set Rng = Sh.Range("A" & Rows.Count).End(xlUp).Offset(1)
  5.     With TextBox1
  6.         If Application.CountIf(Sh.Columns(1), .Text) > 0 Then
  7.             MsgBox "§A¿é¤Jªº­û¤u½s¸¹­«ÂÐ" & vbCrLf & vbCrLf & "½Ð­«·s¿é¤J­û¤u½s¸¹"
  8.             Exit Sub
  9.         ElseIf Len(.Text) = 5 Then
  10.             If IsNumeric(.Text) Then Rng.Cells(1, 1).NumberFormatLocal = "@"
  11.         Else
  12.             MsgBox "­û¤u½s¸¹¬°¤­­Ó¦r¤¸"
  13.             Exit Sub
  14.         End If
  15.     End With
  16.     With TextBox2
  17.         If Application.CountIf(Sh.Columns(2), .Text) > 0 Then
  18.             MsgBox "§A¿é¤Jªº ©m¦W ­«ÂÐ" & vbCrLf & vbCrLf & "½Ð­«·s¿é¤J­û¤u ©m¦W"
  19.             Exit Sub
  20.         ElseIf Len(.Text) = 0 Then
  21.             MsgBox "§A¨S¦³ ¿é¤J©m¦W " & vbCrLf & vbCrLf & "½Ð­«·s¿é¤J­û¤u ©m¦W"
  22.         End If
  23.     End With
  24.     With TextBox3    '¨­¥÷ÃÒ¦t¤¸¬° 10 ­Ó¦t¤¸
  25.         If Application.CountIf(Sh.Columns(3), .Text) > 0 Then
  26.             MsgBox "¨­¥÷ÃÒ¦t¸¹ ­«½Æ" & vbCrLf & vbCrLf & "½Ð­«·s¿é¤J ¨­¥÷ÃÒ¦t¸¹ "
  27.             Exit Sub
  28.         ElseIf Len(.Text) = 10 Then
  29.             If Not IsNumeric(.Text) Then Rng.Cells(1, 3).NumberFormatLocal = "@"
  30.         Else
  31.             MsgBox "¨­¥÷ÃÒ¦t¤¸¬° 10 ­Ó¦t¤¸"
  32.             Exit Sub
  33.         End If
  34.     End With
  35.     With TextBox5    ''¥ß±b§½¸¹¤¸¬° 7 ­Ó¦t¤¸
  36.         If Len(.Text) = 7 Then
  37.             If IsNumeric(.Text) Then Range("­û¤u°ò¥»¸ê®Æ").Cells(mRow1a, 5).NumberFormatLocal = "@"
  38.         Else
  39.             MsgBox "¥ß±b§½¸¹¤¸¬° 7 ­Ó¦t¤¸"
  40.             Exit Sub
  41.         End If
  42.     End With
  43.     With TextBox6       '¦sï±b¸¹¦r¤¸¬° 7 ­Ó¦t¤¸
  44.         If Len(.Text) = 7 Then
  45.             If IsNumeric(.Text) Then Range("­û¤u°ò¥»¸ê®Æ").Cells(mRow1a, 6).NumberFormatLocal = "@"
  46.         Else
  47.             MsgBox "¦sï±b¸¹¦r¤¸¬° 7 ­Ó¦t¤¸"
  48.             Exit Sub
  49.         End If
  50.     End With
  51.     With Rng
  52.         .Cells(1, 1) = TextBox1.Value
  53.         .Cells(1, 2) = TextBox2.Value
  54.         .Cells(1, 3) = TextBox3.Value
  55.         .Cells(1, 4) = TextBox4.Value
  56.         .Cells(1, 5) = TextBox5.Value
  57.         .Cells(1, 6) = TextBox6.Value
  58.         .Cells(1, 7) = TextBox7.Value
  59.         .Cells(1, 9) = TextBox8.Value
  60.         If OptionButton1.Value = True Then
  61.             .Cells(1, 8) = "¦b¾"
  62.         ElseIf OptionButton2.Value = True Then
  63.             .Cells(mRow1a, 8) = "Â÷¾"
  64.         End If
  65.     End With
  66.     MsgBox "¸ê®Æ·s¼W §¹²¦"
  67.     Set Sh = Nothing
  68.     Set Rng = Nothing
  69. End Sub
½Æ»s¥N½X

TOP

ÁÂÁª©¥D¤j¤j¡C

  ¤p§Ì¸ÕµÛ¨Ìª©¥D¤j¤jªº¤è¦¡¡A
¥Ø«eÁÙ¬O¨S¯à¹F¦¨¤p§Ìªº¶·¨D¡C
¨äcomBobox6¨ÌµM¤@¼ËµLªk
¨ú±o©w¸q¦WºÙ­×¥¿«áªº°Ñ·Ó½d³ò¡C
  ¤£ª¾¬O§_¥t¦³¥i¬ð¯}ªº¤è¦¡©O¡H

·P®¦¤j¤j¡I

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2010-10-18 22:44 ½s¿è
ÁÂÁª©¥D¤j¤j¡C
  ¤p§Ì¸ÕµÛ¨Ìª©¥D¤j¤jªº¤è¦¡¡A
¥Ø«eÁÙ¬O¨S¯à¹F¦¨¤p§Ìªº¶·¨D¡C
¨äcomBobox6¨ÌµM¤@¼ËµLªk ...
dechiuan999 µoªí©ó 2010-10-18 20:29

Private Sub CommandButton5_Click()
'
'
If OptionButton1.Value = True Then
                .Cells(mRow1a, 8) = "¦b¾"
            ElseIf OptionButton2.Value = True Then
                .Cells(mRow1a, 8) = "Â÷¾"
            End If
            Names("­û¤u°ò¥»¸ê®Æ").RefersTo = mSht1.Range("A3:I" & mRow1a + 2)  
            ComboBox6.List = [­û¤u°ò¥»¸ê®Æ].Columns(2).Value          '**³]©w­n­«³] ¤~·|¬Ý¨ì**
            .Cells(mRow1a, 1).Select
            End If

TOP

ª©¥D¤j¤j¡C

¤p§Ì¤w´ú¸Õ¦¨¥\¤F¡C
¯u·PÁª©¥D¤j¤jªº¬Û§U¡C
Åý¤p§Ì¯à©ñ¤U¤ß¤¤ªº¤@¶ô
¥ÛÀY¤F¡C

·P®¦¤j¤j¡I

TOP

¦^´_ 4# GBKEE

¯à½Ð ª©¥D¤j¤j À°¦£

comBobox ¦p¦ó¦P®É [¦P¨B°Ñ·Ó]

±N ÁôÂäu§@ªíªº Sheet1 cbFAccounts ComboBox
¯à ¦P¨B°Ñ·Ó¨ì   Sheet12 ComboBox

¦p¹Ï ªººñ¦â¤è¦¡


¦]¤£¦P©ó
LinkedCell
ListFillRange
¤è¦¡

ÁٽЪ©¥D¤j¤j À°¦£

ªþÀÉ

Test.rar (216.34 KB)
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 6# 7777

Sheet1, Sheet12,¤u§@ªí¤WªºComboBox±±¨î¶µ ³£µLªk½s¿è

¾É­P¤U­±ªºµ{¦¡½X¿ù»~
  1. Private Sub ComboBox1_Change()
  2.     Sheet1.cbFAccounts.Value = ComboBox1.Value
  3. End Sub

  4. Private Sub ComboBox2_Change()
  5.     Sheet1.ComboBox1.Value = ComboBox2.Value
  6. End Sub
½Æ»s¥N½X
½Ð±N Sheet1, Sheet12,¤u§@ªí¤WªºComboBox±±¨î¶µ ¥þ§R±¼
­«·s¸m¤J ·sªºComboBox±±¨î¶µ
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD