- ©«¤l
- 552
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 578
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-2-8
- ³Ì«áµn¿ý
- 2024-7-9
|
¦^´_ 3# starry1314
µ¹§A¤@Ó¤j·§ªº¼Ò«¬¡A¨ä¥Lªº½Ð¦Û¦æק鷺®e
¥H¤U¥N½X¥²¶·¦b¤u¨ã>>³]©w¤Þ¥Î¶µ¥Ø¤¤¡A¤Þ¥Î Microsoft Visual Basic For Application Extensibility 5.3<<³oÓn¤Ä¿ï- Option Explicit
- Public Sub ex()
- Dim s As String
- Dim VBCom As Object
- Dim VBP
- On Error Resume Next
- Do
- Err = 0
- Set VBP = ActiveWorkbook.VBProject
- If Err <> 0 Then
- If MsgBox("¥¨¶°¦w¥þ³]¸m¸m¤£¤¹³\¥N¥N½X¶i¦æ¦æ¾Þ§@¡C" & vbCrLf & vbCrLf & "½Ð±N«H¥ô¤¤¤ß¤º«H¥ô¦s¨úVBA±M®×ª«¥ó¼Ò«¬¤Ä¿ï", vbCritical + vbYesNo, "¥¨¶°³]©w") = vbYes Then
- With Application
- .SendKeys "t"
- .CommandBars.FindControl(ID:=3627).Execute
- End With
- Else
- Exit Sub
- End If
- End If
- Loop Until Err = 0
- On Error GoTo 0
- s = "sub ¦Xp()" & vbCrLf '
- s = s & " Dim rng1 As Range, rng2 As Range" & vbCrLf
- s = s & " Dim ¤é´Á As Date" & vbCrLf
- s = s & " With Sheets(1)" & vbCrLf '
- s = s & " ¸¹½X = .Cells(3, 18)" & vbCrLf
- s = s & " ¤é´Á = .Cells(2, 19)" & vbCrLf
- s = s & " Set rng1 = .Columns(1).Find(¸¹½X)" & vbCrLf
- s = s & " Set rng2 = .Rows(1).Find(¤é´Á, LookIn:=xlValues)" & vbCrLf
- s = s & " .Cells(3, 19) = .Cells(rng1.Row, rng2.Column).Value" & vbCrLf
- s = s & " End With" & vbCrLf '
- s = s & "End Sub"
- Set VBCom = ThisWorkbook.VBProject.VBComponents.Add(1) '´¡¤J¼Ò²Õ
- VBCom.Name = "¼Ò²Õ1" 'Åܧó¼Ò²Õ¦WºÙ
- With VBCom.CodeModule
- .InsertLines .CountOfLines + 1, s '¼g¤J¥N½X
- End With
- End Sub
½Æ»s¥N½X |
|