¥»©«³Ì«á¥Ñ starry1314 ©ó 2015-6-12 16:46 ½s¿è
½Ð°Ýn«ç»òקï©O
ÁÙ¬O¥i¥H¥ý¥ÎÅÜ¼Æ Åª¨ú¶}±ÒÀɮ׫eªºµøµ¡¦WºÙ,
EX :
aa = ThisWorkbook.FullName
workbooks.Open ("\\Boss-pc\¤½¥ÎºÏ°Ï\¼Æ¾Ú\¸ê®Æ®w\105-«È¤á©ú²Ó.xlsm")
ActiveWorkbook.Sheets(aa).Select ¦ý»¡µLªkÃѧO...
Sub ¶K¤W¸ê®Æ()
'
workbooks.Open ("\\Boss-pc\¤½¥ÎºÏ°Ï\¼Æ¾Ú\¸ê®Æ®w\105-«È¤á©ú²Ó.xlsm")
ActiveWorkbook.Sheets("¦¬´Ú¸ò¶Ê").Select '¦^¨ì¥XÀ\³æ ·|¥¢±Ñ§ï¥Îthisworkbook¤]¬O·|¥¢±Ñ
Range("A3").Select '¿ï¨ún½Æ»sªº¸ê®Æ¦æ
Dim lSourceRow As Long, lTargetRow As Long
Dim wsTarget As Worksheet
With ActiveSheet
lSourceRow = Selection(1).Row '³QÂIÀ»ªº¸Ó«ö¶s¦æ¼Æ
' If .Cells(lSourceRow, "C").Text = vbNullString Then MsgBox "¤é´ÁÄæµL¸ê®Æ¡AµLªk§PÂ_¶K¤W¤ë¥÷": Exit Sub
'Set wsTarget = Workbooks("«È¤á©ú²Ó(Á`ªí).xlsm").Sheets(GetMonthStr(.Cells(lSourceRow, "C"))) '¤é´Á§PÂ_n¶K¤Wªº¤u§@ªí
Set wsTarget = workbooks("105-«È¤á©ú²Ó(Á`ªí).xlsm").Sheets("«È¤á©ú²Ó")
Windows("105-«È¤á©ú²Ó(Á`ªí).xlsm").Activate
Sheets("«È¤á©ú²Ó").Select
lTargetRow = wsTarget.Cells(Rows.Count, "B").End(xlUp).Row + 1 'n¶K¤Wªº¦ì¸m
Application.ScreenUpdating = False
.Range(.Cells(lSourceRow, "A"), .Cells(lSourceRow, "AR")).Copy '½Æ»sAÄæ¨ìARÄ檺¸ê®Æ
wsTarget.Cells(lTargetRow, "B").PasteSpecial Paste:=xlPasteValues '¦bBÄæ¶}©l¶K¤W
wsTarget.Paste Link:=True '¶K¤W³sµ²
Application.ScreenUpdating = True '¶K¤W³sµ²
End With
'±NÀÉ®×°µ¶W³sµ²¦ÜAÄd
With wsTarget
.Hyperlinks.Add Anchor:=.Cells(lTargetRow, "B"), _
Address:=ThisWorkbook.FullName
'SubAddress:=ThisWorkbook.Sheets("¥XÀ\³æ").Name & "!" & Rows(lSourceRow).Address, _
TextToDisplay:=.Cells(lTargetRow, "b").Text
.Hyperlinks.Add Anchor:=.Cells(lTargetRow, "AT"), _
Address:=ThisWorkbook.FullName
' SubAddress:=.Name '& "!" & Rows(lSourceRow).Address _
'TextToDisplay:=.Cells(lTargetRow, "ao").Text
End With
End Sub |