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

[µo°Ý] Ãö©ó¥ÎVBA¶}±Ò§OªºÀɮ׫á­n¦p¦ó¦^¨ì­ìµøµ¡©O?

[µo°Ý] Ãö©ó¥ÎVBA¶}±Ò§OªºÀɮ׫á­n¦p¦ó¦^¨ì­ìµøµ¡©O?

¥»©«³Ì«á¥Ñ 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

¥»©«³Ì«á¥Ñ starry1314 ©ó 2015-6-12 17:05 ½s¿è

®ð¦º§Ú.........
·Q¥b¤Ñ·Q¤£¥X¨Ó~µ²ªG¤@PO½×¾ÂÆF·P°¨¤W¨Ó

aa = ThisWorkbook.Name
workbooks.Open ("\\Boss-pc\¤½¥ÎºÏ°Ï\¼Æ¾Ú\¸ê®Æ®w\105-«È¤á©ú²Ó.xlsm")  
Windows(aa).Activate

§Y¥i¦^­ì¥»¥¨¶°¶}Àɮ׫eµøµ¡

TOP

        ÀR«ä¦Û¦b : ¨C¤ÑµL©Ò¨Æ¨Æ¡A¬O¤H¥Íªº®ø¶OªÌ¡A¿n·¥¡B¦³¥Î¤~¬O¤H¥Íªº³Ð³yªÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD