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

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

¥»©«³Ì«á¥Ñ 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

¥»©«³Ì«á¥Ñ 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

¦^´_ 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 : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD