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

[µo°Ý] ¬O§_¦³§ó¾A¦X¦r¦êªº½s¿è­×§ï©O¡H

[µo°Ý] ¬O§_¦³§ó¾A¦X¦r¦êªº½s¿è­×§ï©O¡H

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

   ¤p§Ì·Q´£¨Ñ¤@ªí³æ¨ÑUSER
¥i¥H¹ïBÄæ¦ì¸ê®Æ°µ½s¿è¡B­×§ï¦r¦ê¤º®e¡C

¶·¨D¦p¤U¡G
¤@¡BÀx¦s®æªº¸ê®Æ¬°­^¤å¤Î¼Æ­È²Õ¦X
¤G¡B¶·逹¦¨Àx¦s®æªº¦r¤¸¬°12­Ó¦r¤¸
¤T¡B¥i´¡¤J¦r¤¸¡B§R°£¦r¤¸¡B­×§ï¦r¤¸¡B´À´«¦r¤¸

   ¤p§Ì¤w§¹¦¨¤@ªí³æ¡A¤£ª¾¬O§_¦³¤£¶g©µ¤§³B¡C
¥t·Q½Ð敎¦U¦ì¤j¤j¬O§_¦³§ó¾A¦Xªº
¤è¦¡¥i¨ÑUSER¹ïÀx¦s®æªº¦r¦ê°µ¤W­zªº¾Þ§@¶Ü¡H

  ¤p§Ì¦P®É¤]·Q½Ð敎¦U¦ì¤j¤j¡A¦b¦¹¤@ªí³æ¨ä
Set mSht1 = Worksheets("UPDATA")
¦p¦ó¥i²¤Æ¶È¦C¥X¤@¦¸¦Ó¤£¥²³v¤@¦C
¥X¦b¤£¦Pªº±±¨î¶µ¸Ì³]©w©O¡H

ÁÂÁ¦U¦ì¤j¤j¡C

CHARACTER.rar (22.82 KB)

¦^´_ 1# dechiuan999
¸Õ¸Õ  Replace ¨ç¼Æ  »P Replace ¤èªk  Application.WorksheetFunction.Replace ¦³ÂI¤£¤@¼Ë

Replace ¨ç¼Æ ¶Ç¦^¤@­Ó¦r¦ê¡A¸Ó¦r¦ê¤¤«ü©wªº¤l¦r¦ê¤w³Q¨ú¥N¦¨¥t¤@¤l¦r¦ê¡A¨Ã¥B¨ú¥Nµo¥Íªº¦¸¼Æ¤]¬O«ü©wªº¡C
»yªk   Replace(expression, find, replace[, start[, count[, compare]]])
Replace ¨ç¼Æ»yªk¦³¦p¤U´X­Ó«ü¦W¤Þ¼Æ¡G
³æ¤¸ ´y­z
expression ¥²­n¤Þ¼Æ¡C¦r¦ê¹Bºâ¦¡¡A¥]§t­n¨ú¥Nªº¤l¦r¦ê¡C
find ¥²­n¤Þ¼Æ¡C­n·j´M¨ìªº¤l¦r¦ê¡C
replace ¥²­n¤Þ¼Æ¡C¥Î¨Ó¨ú¥Nªº¤l¦r¦ê¡C
start ¿ï¾Ü©Ê¤Þ¼Æ¡C¦b¹Bºâ¦¡¤¤¤l¦r¦ê·j´Mªº¶}©l¦ì¸m¡C¦pªG©¿²¤¡A°²©w±q1¶}©l¡C
count ¿ï¾Ü©Ê¤Þ¼Æ¡C¤l¦r¦ê¶i¦æ¨ú¥Nªº¦¸¼Æ¡C¦pªG©¿²¤¡A¹w³]­È¬O ¡V1¡A¥¦ªí©ú¶i¦æ©Ò¦³¥i¯àªº¨ú¥N¡C
compare ¿ï¾Ü©Ê¤Þ¼Æ¡C¼Æ¦r­È¡Aªí¥Ü§P§O¤l¦r¦ê®É©Ò¥Îªº¤ñ¸û¼Ò¦¡¡CÃö©ó¨ä­È¡A½Ð°Ñ¾\¡u³]©w­È¡v¡C

TOP

¥»©«³Ì«á¥Ñ dechiuan999 ©ó 2012-6-17 13:52 ½s¿è

ÁÂÁª©¥D¤j¤jªº«üÂI¡C
ª½±µ¨Ï¥ÎREPLACE¨ç¼Æ¥i´£¤É
¥\¯à©Ê¡C¨º¬O§_¦³¤èªk¥i¨Ï¥Î
·Æ¹«ª½±µ¿ï¨úTextbox1.Textªº¬Y¤@³sÄò¦r¦ê
¨Ã¾É¤J¦ÜTextbox2.text¦Ó¤£¥²¿é¤J
­n§ó´«ªº¦r¦ê©O¡H

¤U¦C¬O¤p§Ì¥t¤@²©öªºªí³æ

ComboBox1¡÷«ü©w­n´À´«¦r¦êªº¦¸¼Æ
Textbox1 ¡÷¥ÑÀx¦s®æ¶Ç¤Jªº¦r¦ê
Textbox2 ¡÷¯à§_¥Ñ·Æ¹«¿ï¨úTextbox1ªº¬Y¤@³sÄò¦r¦ê¨Ã¾É¤J¦ÜTextbox2©O¡H
Textbox3 ¡÷«ü©w­n§ó´«ªº¦r¦ê¡A¶·¥ÑÁä½L¿é¤J¦r¦ê

Private Sub CommandButton1_Click()
   
    Dim mTxt1$, mTxt2$, mTxt3$
    Dim C1%
   
    C1 = ComboBox1.Value    '«ü©w­n´À´«¦r¦êªº¦¸¼Æ
    mTxt1 = TextBox1.Text   '¥ÑÀx¦s®æ¶Ç¤Jªº¦r¦ê
    mTxt2 = TextBox2.Text   '¯à§_¥Ñ·Æ¹«¿ï¨úTextbox1ªº¬Y¤@³sÄò¦r¦ê¨Ã¾É¤J¦ÜTextbox2©O¡H
    mTxt3 = TextBox3.Text   '«ü©w­n§ó´«ªº¦r¦ê¡A¶·¥ÑÁä½L¿é¤J¦r¦ê
   
    mTxt1 = Replace(mTxt1, mTxt2, mTxt3, 1, C1, vbTextCompare)    'ª½±µ¤Þ¥ÎReplace¨ç¼Æ,逹¦¨½s¿è¡B­×§ï¡B§R°£¡B´À´«¡C
   
    TextBox1.Text = mTxt1
    Range("A1") = TextBox1.Text
   
   
End Sub

Private Sub UserForm_Initialize()
   
    TextBox1.Text = "ABCDEFG1234D5D6"
    With ComboBox1    '
        .AddItem "1"
        .AddItem "2"
        .AddItem "3"
        .Value = 1
    End With
   
End Sub

test.rar (6.99 KB)

TOP

¦^´_ 3# dechiuan999
¸Õ¸Õ¬Ý

TEST.rar (9.67 KB)

TOP

ÁÂÁª©¥D¤j¤j¡C
¤p§Ì¤w¦¬¤U¤]¬ã¨s¦n¤@°}¤l¡A
ÁÙ¬O¥þµM¨S¦³§¹¥þ»â·|¨ä§t·N¡C
¤µ¤Ñ¤U¤ÈÀY¸£¯uªº¦³ÂI¤£²M¿ô¡A
¶V·Q¥¦ÀY¸£´N¶VÂण¹L¨Ó¡A¥u¦n¥ý¦¬§L
µ¥ÀY¸£²M¿ô¤@ÂI¦A¦n¦n¬ã¨s¥¦¤F¡C

·P®¦ª©¥D¤j¤j¡I

TOP

¦^´_ 5# dechiuan999
¥i°Ñ¦Ò³o½g
PS : ¦^¤å®É  ½Ð«ö [¦^ÂÐ] «ö¶s  µªÂЧAªº¤H¤~·|±o¨ì³qª¾,

TOP

¦^´_ 6# GBKEE


    ÁÂÁª©¥D¤j¤j¡C
¤p§Ì¤é«á·|§ï¶i¡C
¤p§Ì¥¿¦b¨D¸Ñ¤¤¡C
replace¨ç¼Æ¤ñ¤p§Ì·Q¹³¤¤
­n½ÆÂø¤@¨Ç¡C

ÁÂÁ±z¡I

TOP

¦^´_ 7# dechiuan999
Replace ¨ç¼Æ ªº¥Îªk
  1. Sub Ex()
  2.     Dim W As String
  3.     W = "1ABCDE2ABCDE3ABCDE4ABCDE"
  4.     MsgBox Replace(W, "E", "?", , 1) & Chr(10) & _
  5.            Replace(W, "E", "?", 7) & Chr(10) & _
  6.            Replace(W, "E", "?", 13, 1)
  7. End Sub
½Æ»s¥N½X

TOP

¦^´_ 8# GBKEE


    ÁÂÁª©¥D¤j¤j¡C
ª©¥D¤j¤j¦A¦¸´£¨ÑReplace¨ç¼Æ½d¨Ò
¦bÀ³¥Î¤Wªº®t²§¡A¤]Åý¤p§Ì²z¸Ñ
¤Þ¼Æstart¤Îcount ¨ä¤¤ªºÅܤơC
¤p§Ì¤]¤F¸Ñ¦Û¤w¦b¾Ç²ß¤W
Á`¬O³B¦b¤@ª¾¥b¸Ñªºª¬ºA¡F
³o¤]¬OÅý¤p§Ì¤@ª½µLªk§ó
¤W¤@¼hªº­ì¦]¡C
¤p§Ì¤]·|±Nª©¥D¤j¤j´£¨Ñ
ªº½d¨Ò¥[¥Hµo´§¤ÎÀ³¥Î¡C

·P®¦¤j¤j¡I

TOP

¦^´_ 8# GBKEE


    ª©¥D¤j¤j±z¦n¡G
¤p§Ì¥Ñª©¥D¤j¤j´£¨Ñªºªk¤¤
¦h¾Ç¨ì¤FTextbox¤T­ÓÄÝ©Ê
SelText,SelLength,SelStar
¥t¤p§Ì¤]µo²{SelStarªº°_ºâ
¬O¥Ñ0°_ºâ¡C¦]¦¹¡A»yªk¤W¤p
§Ì¤]­×¥¿¬°
If Shift = 4 And KeyCode = 13 Then TextBox4 = TextBox1.SelStart + 1

¥tTextBox2_Change¤º¦³¤GÂIºÃ´b
¤@¡B
xText = Mid(xText, InStr(xText, TextBox2) + Len(TextBox2))
¦³¦ó¥Î·N©O¡H
¤G¡B
Do While InStr(xText, TextBox2)
¦¹»yªk»P¤p§Ìªº»{ª¾¦³©Ò¤£¦P
¤p§Ì§ï¦¨
x2=InStr(xText, TextBox2)
do while x2
´N·|²£¥ÍµL½a°j°é
¤p§Ì´N¤£ª¾ª©¥D¤j¤jªº
»yªk¬°¦ó¤£·|²£¥ÍµL½a°j°é©O¡H

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

TOP

        ÀR«ä¦Û¦b : °µ¸Ó°µªº¨Æ¬O´¼¼z¡A°µ¤£¸Ó°µªº¨Æ¬O·Mè¡C
ªð¦^¦Cªí ¤W¤@¥DÃD