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

[µo°Ý] ¸ê®Æ·j´M°ÝÃD

[µo°Ý] ¸ê®Æ·j´M°ÝÃD

¦U¦ì¤j¤j¦n~
¤é±`¸ê®Æ³B²z¦ýVBA­è¤Jªù¤£¤Ó¼ô±xÀ³¥Î¡A¦³°ÝÃD·Q½Ð°Ý¡A
1.¦p¦ó¨Ï¥Î¦pTextBox¥\¯à±N¨ú±o¸ê®Æ°µ¬°·j´M¯S©w¦r¼Ë textbox©ÒÀò¨úªº¦r¦ê¦p¦ó¤Þ¥Î
2.¥H¦¹¯S©w¦r¦ê§ä±o¸Ó¦r«á¦p¦ó¾Þ§@¥i±Nexcel¦C¥þ¼Æ§R°£¡C¦¹³øªí¦]¸ê®Æ®w¿é¥X«áµLªk¹w¦ô©Ò
¦ûµ§¼Æ¬Ò·|¥H¦C¤è¦¡§e²{¡A»Ý­nªº¸ê®Æ¦C¤U¬Ò¬°¤£»Ýªº¸ê®Æ¥i¥H¤Þ¥Î¦óºØ»yªk¤è¦¡¦¹¦r¼Ë¥H¤U
¦C¥þ¼Æ§R°£¡A¦]µLªk«ü©w¦b¨º¤@¦C¡C
ÁÂÁ¤j®a
¦p¤S©Î¬O¨Ï¥ÎInputBox¤è¦¡¾Þ§@¬O§_¸û¨ã«K§Q©Ê¡A¥t¦³¤@°ÝÃD´M°Ýtextbox¤Îinputbox¬O§_¬Ò¤£
ª½±µ¥ÑexcelÀx¦s®æ¤WÂШ®e¶K¤W¥\¯à¡AÁÂÁ¸ѵª

¤£¦n·N«ä³Â·Ð¤j®a¤F

¦^´_ 1# ayubbs
§Ú¸ÕµÛ¤À§O¥Î TextBox¡BListBox »P ComboBox ¨Ó¹ê°µ:
¸ê®Æ·j´M-A.zip (23.05 KB)
1. ¦b Sheet2 ¦³«O¯d­ì©l´ú¸Õ¸ê®Æ, ¥H«K©ó´ú¸Õ¥\¯à«á¸ê®Æ¯Ê¥¢®ÉÁÙ­ì¸ê®Æ¥Î.

2. TextBox »Ý¥H·Æ¹«¥ªÁä©ì¦² Mark ¾ã¦æªº©m¦W(¨â­Ó¦r, ¨Ò¦p : »¯¤»), ©ó©ñ¶}·Æ¹«¥ªÁä«á, §Y§¹¦¨¿ï¨úªº°Ê§@.
   ¦]¬°¤ñ¸û¤£¦n¿ï¾Ü¨ì¼Ðªº, «Øij¥i¥ýÂI¤@¤U©m¦W, ¦A«öÁä½L¤Wªº¦V¤W¦V¤U«öÁä§ä¨ì¼Ðªº,¦A¨Ì¤W­z¤º®e°õ¦æ Mark °Ê§@§Y¥i.

3. ListBox «h©óÂIÀ»¤W©Î¤U½bÀY§ä¨ì¼Ðªº©m¦W®É, ¦A¥H·Æ¹«¥ªÁäÂI¤@¤U¸Ó©m¦W, §Y§¹¦¨¿ï¨úªº°Ê§@.

4. ComboBox «h©ó¤U©Ô¦¡¿ï³æ¤¤¿ï¨ú¼Ðªº©m¦W, §Y§¹¦¨¿ï¨úªº°Ê§@.

5. ¿ï¨ú§¹¦¨«á, ÂI¤@¤U "§R°£¸ê®Æ" «ö¯Ã, ´N¥i¥H§R°£©Ò¦³¬Û¦P©m¦Wªº¸ê®Æ¦C.


¥t¥~§Ú¦­«e¹ê°µ´ú¸Õªº¥t¤@­ÓÀÉ®×, ¸ê®Æ·j´M-A-Wrong.zip (17.77 KB)

­Y¿ï¨ì³Ì«á¤@­Ó©m¦W(¨Ò¦p : §d¤K)«á,

¦A°õ¦æ ListBox ªº RemoveItem ¤èªk·|µo¥Í¿ù»~,

¦ý¤£¬O§R³Ì«á¤@µ§®É´N¤£·|¦³¿ù»~, ¿ù»~°T®§.JPG

¤£ª¾¹D°ÝÃD¥X¦b­þ¸Ì?

TOP

¦^´_ 2# luhpro


    ÁÂÁ¤j¤j¼ö¤ß¨ó§U.¦]¤H¦b¥~­±§Ú¦^¨ì®a«á´ú¸Õ,¦A¦^³øµ²ªG~·PÁÂ

TOP

¦^´_ 3# ayubbs


¦p¹Ï ©Ôªø¥¦´N¨S¦³¿ù»~¤F(¬°¦ó·|¦p¦¹§Ú¤]¤£ª¾¹D)

©Î­×§ïµ{¦¡½X
  1. rivate Sub cbDel_Click()
  2.     Dim i As Integer
  3.     'Application.EnableEvents = False  '³o¹ï±±¨î¶µ¨S¦³§@¥Î
  4.     With lbName
  5.         i = .ListIndex
  6.         If i = -1 Then Exit Sub
  7.         Selection.Delete
  8.         If .ListIndex + 1 = .ListCount Then .Value = .ListIndex - 1
  9.         If .ListCount >= 1 Then .RemoveItem (i)
  10.     End With
  11.    'Application.EnableEvents = True
  12.    ' Call lbName_Change
  13. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE
¤£¦n·N«ä¨º»ò±ß¤~¦^ÂÐ~¤u§@¸û¦£¸L¨ì²{¦b¤~¦^ÂÐ
ÁÂÁÂluhpro¤j~¸òGBKEEª©¤jªº¨ó§U¦^ÂСA¤£¹L¯uªº«Ü¤£¦n·N«ä¡C
¥i¯à¬O§Úªí¹Fªº¤è¦¡¤£¥¿½T¡A³y¦¨luhproªº»~¸Ñ¤è¦V¤£¹ï¡A«Ü©êºp¡A§Ú·Q­nªº´M§ä¸ê®Æ¤è¦¡§Ú­«·s»¡©ú¤@¤U¡A¦]¤u§@¤¤¸g±`
»Ý®Ö¹ï¸ê®Æ¡A¸Ó¸ê®Æ¬°¸ê®Æ®w¿é¥XªºxlsÀɮסA¨ä¤¤¥H¦³®MªOªº®æ¦¡¡A«Ü¦hªºÄæ¦ì¡A¦C¼Æ¨Ì¬d¸ß¤ñ¸ûªº°Ï¶¡¥i¯à·|¦³¼Æ¦Ê¼Æ¤d¸ê®Æ
°Ï¶¡­n¦A¤j¨Ç¥i¯à·|¦³¤W¸Uµ§¡A¦ý¦¹¸ê®Æ¥L¦³¤@¨Ç³¡¥÷¸ê®Æ¦³Ãþ¦ü¬y¤ô¸¹ªºÄæ¦ì¡A¦ý¿é¥X®É«oµLªk«ü©w¬y¤ô¸¹°Ï¶¡½Õ¥X¸ê®Æ¡A¥u
¯à¥H¶g©Î¤ëªº¤è¦¡¿é¥X¸ê®Æ¡C

¦]¬d¸ßÀW«×¤Ó°ª¡A¸g±`ªá¤F«Ü¦h®É¶¡¤@ª½°µ­«ÂЪº°Ê§@¡A·Q²¤Æµ{§Ç¡A·Q¥Î¤@­Ó§t¦³³]©w¦nªº¿W¥ßvbaÀÉ®×¥h°õ¦æ±Æ§Ç¥h°£¤£»Ý­n
ªº¦C¼Æ¡A¦³ºc·Q¨Ï¥Îtxtbox¿é¤J«ü©wªº¬y¤ô¸¹¡A¥Hª½±µ¨ì¤è«Kª½±µ¿ï¾Ü¨ì¸Ó¦C±N¸Ó¦C¥H¤U¤£»Ý­nªº¸ê®Æ¥þ¼Æ§R°£¦]©ïÀYÁÙ¦³¶µ¥Ø»Ý
¬Ý©Ò¥HµLªk¦V¤W§R°£¥u¯à¦V¤U§R°£¡A¦ý§Úªºvba¹ê¦b«Ü®t....µLªk¹F¦¨¡A¬O§_¥i¦A¦V¤j¤jª©½Ð±Ð¬O§_¥i¦³¤è¦¡¥i¸Ñ¨M

¬yµ{¬ù¦p¤U    ³]¸m¤@­ÓÀÉ®×aa.xls©óSheet1«Ø¤@CommandButton¥Î©ó¶}±ÒUserForm1¡AUserForm1»s§@¤@ªí³æ TextBox ¿é¤J¬y¤ô¸¹
¡÷¨Ï¥ÎCommandButton1¤Þ¥ÎTextBox¤º¼Æ¾Ú¬d´M¨ìbb.xslÀɤº¸Óµ§¸ê®Æ©Ò¦b¦C±N¨ä¸Ó¦C§t¥H¤U¦C¦Û°Ê¥þ¼Æ
§R°£¤£»Ý¸ß°Ý¡A¥t¨ä¥¦°Ê§@¤@¨Ç¿z¿ï¤ñ¹ï°Ê§@¤]©ó¦¹CommandButton§@®É¾÷¤@¨Ö§@°Ê¡C
¦ý¥ý§ä¨ì¸Ó¤u§@¦C¬°³Ì¥ý¶}©lªºµ{§Ç¡C

¦U¦ì¦Ñ®v­Ì¯à§_¶¶«K«ü¾É¤@¯ë¨Ï¥Î txtbox ¤º¼Æ­È¡A­n¦ó¼gªº¤è¦¡¤~¥i¤Þ¥Î¥L°µ¬°¤@°Ñ¦Ò¼Æ¾Ú¨ä°Ñ¼Æ¹B¥Îªº¤è¦¡¡C

¯uªº·P¨ì«Ü¤£¦n·N«ä¤S¦A¦¸³Â·Ð¤j®a¤F¡A¯uªº­n¦h§V¤O¤F¡A¤@¨Ç»yªk¥u·|°µ«Ü²¦¡ªº³æ¿W¨Ï¥Î¡A´ê¦b¤@°_´N¥d¦º¤F¡A­n¦A¦h§V¤O¤F¡C
ÁÂÁÂ

TOP

¦^´_ 5# ayubbs
¤Þ¥ÎTextBox¤º¼Æ¾Ú¬d´M¨ìbb.xlsÀɤº¸Óµ§¸ê®Æ©Ò¦b¦C±N¨ä¸Ó¦C§t¥H¤U¦C¦Û°Ê¥þ¼Æ
¸Óµ§¸ê®Æ¦b­þ¤@Äæ (AÄæ©ÎBÄæ  ©Î...)
½Ð¤W¶Ç bb.xls ªº½d¥»,¦n¤F¸Ñ¤§.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ ayubbs ©ó 2013-8-5 23:28 ½s¿è

¦^´_ 6# GBKEE


    ª©¤j¦pªþ¥ó,»Ý¤ÀªRÄæ¦ì¬°CÄæ¦A³Â·Ð§A¤F,CÄ涵¥Ø¤º¨Ã«D¤@©w·|¨Ì¬y¤ô¸¹±Æ㡰¦h¼Æ®É­Ô³£»Ý­n¦Û¤v±Æ§Ç

BB.rar (44.81 KB)

BB.rar (44.81 KB)

TOP

¦^´_ 7# ayubbs
Sheet1«Ø¤@CommandButton
  1. Private Sub CommandButton1_Click()
  2.     UserForm1.Show
  3. End Sub
½Æ»s¥N½X
  1. Option Explicit
  2. Dim WB As Workbook, Rng As Range
  3. Private Sub CommandButton1_Click()
  4.     If Not Rng Is Nothing Then
  5.         With Rng.Parent
  6.             Set Rng = .Range(Rng.Offset(1), Rng.Offset(1).End(xlDown))
  7.             Rng.EntireRow.Delete
  8.         End With
  9.     End If
  10.         CommandButton1.Enabled = False
  11. End Sub
  12. Private Sub TextBox1_Change()
  13.     CommandButton1.Enabled = False
  14.     Set Rng = WB.Sheets("©ú²Óªí").Range("C:C").Find(TextBox1, LookAt:=xlWhole)
  15.     If Not Rng Is Nothing Then CommandButton1.Enabled = True
  16. End Sub

  17. Private Sub UserForm_Initialize()
  18.     CommandButton1.Enabled = False
  19.   ' Set WB = Workbooks.Open("D:\§Aªº¥Ø¿ý¸ê®Æ§¨\BB.XLS")   '¦p BB.XLS ¨S¶}±Ò¥Î¦¹µ{¦¡½X ¶}±Ò
  20. End Sub

  21. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  22.    '  WB.Close True                                        ¦p BB.XLS ¤£¬O¥Îµ{¦¡½X¶}±Òªº ¤£­n¥Î¦¹µ{§Ç
  23. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# GBKEE


ÁÂÁª©¤j«ü¾É¡Aªì¨B´ú¸Õ~¥i¥H¥¿±`¨Ï¥Î¡A¯uªº¬O¤Ó·PÁ¤F¡Aµy±ß¨Ç§Ú¦A§â³Ñ¾l°Ê§@¾ã²z~¦X¨Ö¬Ý¬O§_ÁÙ¦³¨ä¥¦°ÝÃD¦]¬°¤âÃä²{¦b
ÁÙ¯ÊÀÉ®×¥i¥H¾ã¨Ö´ú¸Õ¡A¨S¿ìªk½T©w«áÄò°Ê§@ ^^

TOP

¦^´_ 8# GBKEE

ª©¥D¤j¤j~¦³¥t¤@¨Ç°ÝÃD·Q½Ð±Ð«ü¾É¡A¦]§R°£®É¨Ã¥¼¦³¸ê®Æ±Æ§Ç¦]¬y¤ô¸¹²£®É¿é¥X®É¨Ã¤£¤@©w¥þ¼Æ¦³±Æ¦C¡A¥i§_¥ýÅý¸ê®Æ±Æ§Ç
«á¦A¦æ§R°£«ü©w¸¹(§t)¸Ó¦C¦ì¤Î¨ä¥¦¤£»Ý­nªº¦C¡A¥t©ïÀY¦C­n§R°£¸Ó¦b¦ó³B¥[¤J»yªk¤S¸Ó¦p¦ó¹ê¦æ¡A·QÅýªí¦C©ú²Ó¸û¬°°®²b¾ã»ô
¨Ç¡A¦A¦p©|¦³¤w¿ý»s¦n¥¨¶°¸Ó¥Î¦ó¤è¦¡´¡¤J¥i¥H¦b§R°£°Ê§@§¹¦¨«á¡AÄ~Äò°õ¦æ¦Ó¤£°±Â\§¹¦¨°Ê§@~


>"< ©êºp¦b§V¤Ok®Ñ´c¸É¤¤~¦ý¤é±`¤u§@ÁÙ¦b«ùÄò¤@ª½¶i¦æ~¥ý¯à¹B¥Î¦A¤@¤@¤F¸Ñ­ì²z~ «D±`·PÁÂ

TOP

        ÀR«ä¦Û¦b : ¹ï¤÷¥À­nª¾®¦¡A·P®¦¡B³ø®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD