- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¥»©«³Ì«á¥Ñ yen956 ©ó 2015-11-6 17:52 ½s¿è
¸Õ¸Õ¬Ý:
Q1:- Private Sub CommandButton1_Click()
- Dim sCel As Range
- Dim inTxt, First1 As String
- Dim LastRow As Long
- Range("K2:N" & Rows.Count & "").ClearContents '²M°£¥ý«e·j´Mªº¸ê®Æ"
- inTxt = InputBox("½Ð¿é¤J·j´M¯Z¯Å", "·j´M¯Z¯Å")
- If inTxt = "" Then Exit Sub 'Y¨Ï¥ÎªÌ«ö [¨ú®ø] «hÂ÷¶}
- Set sCel = [A:A].Find(What:=inTxt, LookAt:=xlWhole)
- If sCel Is Nothing Then
- MsgBox ("¥¼§ä¨ì§An·j´Mªº¯Z¯Å"), vbCritical
- Exit Sub
- End If
- First1 = sCel.Address '«O¯d²Ä¤@Ó·j´M¨ìªº¦ì§}
- Do
- LastRow = Cells(Rows.Count, 11).End(xlUp).Row + 1
- sCel.Resize(1, 4).Copy Cells(LastRow, 11)
- Set sCel = [A:A].FindNext(sCel) '´M§ä¤U¤@Ó
- Loop Until First1 = sCel.Address '¤U¤@Óªº¦ì¸m=²Ä¤@Óªº¦ì¸m(¦^¨ì²Ä¤@Óªº¦ì¸m)
- End Sub
½Æ»s¥N½X Q2:- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim sh1, sh2 As Object
- Dim sCel As Range
- Dim First1 As String
- Dim LastRow As Long
- Set sh1 = Sheets("¤u§@ªí1")
- Set sh2 = Sheets("¤u§@ªí2")
- If Intersect(Target, sh2.[I1]) Is Nothing Then Exit Sub
- If Target = "" Then Exit Sub
- sh2.Range("H4:K" & sh2.Rows.Count & "").ClearContents '²M°£¥ý«e·j´Mªº¸ê®Æ"
- sh1.Activate
- With sh1
- Set sCel = .[A:B].Find(What:=Target, LookAt:=xlPart)
- If sCel Is Nothing Then
- MsgBox ("¥¼§ä¨ì§An·j´Mªº¸ê®Æ"), vbCritical
- Exit Sub
- End If
- First1 = sCel.Address '«O¯d²Ä¤@Ó·j´M¨ìªº¦ì§}
- Do
- LastRow = sh2.Cells(sh2.Rows.Count, 8).End(xlUp).Row + 1
- sCel.Resize(1, 4).Copy sh2.Cells(LastRow, 8)
- Set sCel = .[A:B].FindNext(sCel) '´M§ä¤U¤@Ó
- Loop Until First1 = sCel.Address '¤U¤@Óªº¦ì¸m=²Ä¤@Óªº¦ì¸m(¦^¨ì²Ä¤@Óªº¦ì¸m)
- End With
- sh2.Activate
- End Sub
½Æ»s¥N½X |
|