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

[µo°Ý] Ãö©ó¦Û°Ê¶}±Ò«ü©w¦ì¸mÀÉ®×or¶W³sµ²¸ô®|ªºÀÉ®×

¦^´_ 8# luhpro


    ¦^´_ 8# luhpro

½Ð°ÝÃö©ó
  1.          'lSourceRow = Selection(1).Row   '³QÂIÀ»ªº¸Ó«ö¶s¦æ¼Æ
  2.          lSourceRow = .Buttons(Application.Caller).TopLeftCell.Row
½Æ»s¥N½X
³o¬O¥Î«ö¶s°µ,¨º¦pªG¬O¨Ï¥Î¹Ï®×©O?
µLªk¨ú±o.ButtonsÄÝ©Ê

TOP

¦^´_ 10# starry1314


    °£¤F Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(.cells("¤@¤ë") ³o¦C
¨ä¥Lªº­Y®³±¼¥i¥H¥¿±`¤u§@®³±¼¤]µL§Ï¡I
.Activate¬O«ü©w§@¥Î¤¤ªº¤u§@ï¡B¤u§@ªí¡A¤]´N¬O»¡§A²{¦b¦b³o¸Ì¤u§@¡C¦bµ{§Ç¤¤°£«D§A«ü©w«á¦³¯S§O§@¥Î¡A§_«h¨S¦³¤°»ò·N¸q¡I
.Select¬O«ü©w¥h¿ï¾Ü­þ¤@­Ó¤u§@ªí©ÎÀx¦s®æ¡AµM«á¦b³o¤u§@¡C¦bµ{§Ç¤¤°£«D§A«ü©w«á¦³¯S§O§@¥Î¡A§_«h¨S¦³¤°»ò·N¸q¡I

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2015-6-7 09:28 ½s¿è
¦^´_  luhpro
...
¥t·Q½Ð°Ý¤@¶}©lµ¹§Úªº
   sPath = ThisWorkbook.Path
ChDrive sPath
ChDir sPath
§@¥Î¬O? ¦]¥ÎºÊ¬Ý¦¡¬Ý¤£À´,¹Á¸Õ§â¥L®³±¼ÁÙ¬O¥¿±`¹B§@
...
starry1314 µoªí©ó 2015-6-6 01:25

³o¬O¹ï§A 1# ©Ò´£ :
­n«ç»ò³]©w¦¨«ü©w¸ô®|µM«áÀɦW,¥i¥HŪ¨úÀx¦s®æªºÀɦW°µÅܼƩO?
²q´ú§A¬O­n¥ý³]©w¦n¥Ø«e¤u§@¥Ø¿ý,
§â©Ò¦³·|¥Î¨ìªºÀɮ׳£©ñ¦b¸Ó¥Ø¿ý¤U,
´N¤£¥Î¦b¶}±ÒÀÉ®×®ÉÁÙ­n¥t¥~«ü©wÀɮשҦbªº¥Ø¿ý,
¥u­nµ¹ÀɦW´N¥i¥H¨Ï¥Î¸ÓÀɮפF.

¥t¥~,³o¤@¦æÀ³¸Ó¬O¤£¹ïªº°Ú:
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(.cells("¤@¤ë")
Cells() ªº¬A©·¤¤¶¡¥u¯à¬O ¦C¸¹,¦æ¸¹ ¦Ó¤£¯à¬O¦r¦ê,
¥B§A¸Ó¦æªº¬A¸¹¤]¨S¦³¦¨¹ï.

Paste ¨ç¼Æ°õ¦æ®ÉÀ³¸Ó¥i¥H¤£¥Î¥ý§â¼Ðªº¤u§@ïActivate,
¤]¤£¥Î§â¼Ðªº¤u§@ªí¤Î¼ÐªºÀx¦s®æ Select,
ª½±µ¥H With wsTarget »P End With¥]¦í,
¦A©ó¨ä¤¤¥Î . ¥N´«§Y¥i.
©Î¬O¥Î wsTarget.cells... ¥ç¥i.

¦]¬°¤£¯à½T»{§A»yªk¦³¿ù»~ªº³o¤@¦æ :
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(.cells("¤@¤ë")
¼Ðªº¬O§_¬°¥iÅܰʪº,
©Ò¥H¼È®É¤£¯à¹ï¨º¨Ç«ü¥O°µÀu¤Æ.


¦^´_  luhpro
    ¦^´_  luhpro
½Ð°ÝÃö©ó³o¬O¥Î«ö¶s°µ,¨º¦pªG¬O¨Ï¥Î¹Ï®×©O?
µLªk¨ú±o.ButtonsÄÝ ...
starry1314 µoªí©ó 2015-6-6 17:38

°w¹ï¹Ï®×?
³o­Ó§Ú¤]¤£·|³á,©êºp.

TOP

¦^´_ 13# luhpro


    ÁÂÁ«ü¾É~§Ú¦A¬ã¨s¤@¤U,

TOP

¦^´_ 13# luhpro


    ¥t¥~,³o¤@¦æÀ³¸Ó¬O¤£¹ïªº°Ú:
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(.cells("¤@¤ë")
Cells() ªº¬A©·¤¤¶¡¥u¯à¬O ¦C¸¹,¦æ¸¹ ¦Ó¤£¯à¬O¦r¦ê,
¥B§A¸Ó¦æªº¬A¸¹¤]¨S¦³¦¨¹ï.

·|¤£·|¬O ¦]«e­±¬O¦³¥Î¤é´Á§PÂ_­n¨Ï¥Î­þ­Ó¤ë¥÷sheets ©Ò¤wcells¤~¥i¥Î
  1. Function GetMonthStr(inDate As Date) As String
  2.     Select Case Month(inDate)
  3.         Case 1
  4.             GetMonthStr = "¤@¤ë"
  5.         Case 2
  6.             GetMonthStr = "¤G¤ë"
  7.         Case 3
  8.             GetMonthStr = "¤T¤ë"
  9.         Case 4
  10.             GetMonthStr = "¥|¤ë"
  11.         Case 5
  12.             GetMonthStr = "¤­¤ë"
  13.         Case 6
  14.             GetMonthStr = "¤»¤ë"
  15.         Case 7
  16.             GetMonthStr = "¤C¤ë"
  17.         Case 8
  18.             GetMonthStr = "¤K¤ë"
  19.         Case 9
  20.             GetMonthStr = "¤E¤ë"
  21.         Case 10
  22.             GetMonthStr = "¤Q¤ë"
  23.         Case 11
  24.             GetMonthStr = "¤Q¤@¤ë"
  25.         Case 12
  26.             GetMonthStr = "¤Q¤G¤ë"
  27.     End Select
  28. End Function
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2015-6-8 22:08 ½s¿è
¦^´_  luhpro
    ¥t¥~,³o¤@¦æÀ³¸Ó¬O¤£¹ïªº°Ú:
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm" ...
starry1314 µoªí©ó 2015-6-7 11:09

ÁÙ¬O¤£¹ïªº°Ú.

­º¥ý,
§A¸Ó¦æªº¬A¸¹¤]¨S¦³¦¨¹ï,
³o´N¤w¸g¥ý·|µo¥Í»yªk¿ù»~¦Ó¾É­P¾ã­Ó Sub À³¸Ó³£°õ¦æ¤£¤U¥h¤F.

­Y­n¤Þ¥Î§A 15# ©Ò­zªº Function,
¨º»ò¸Ó¦æ¤j¬ùÀ³¸Óªø¦¨©³¤U³o¼Ë :
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(GetMonthStr(inDate))
¦Ó¤£À³¸Ó¦³ Cells ³o­ÓªFªF.

§ó¹N½×§A¨º­Ó ("¤@¤ë") ¬O¤w¸g°v¦º¬° "¤@¤ë" ªº,
»P GetMonthStr ³o­Ó Function «ç»ò¤]¤£¸Ó²o¦b¤@°_.

§Ú­è­è¦A¦¸¬d¤F¤@¤U Excel 2003 ¤¤Ãö©ó Range ªº»¡©ú, ½T»{¥¦ªº±Ô­z :
Cells ÄÝ©Ê
¥i¥Î Cells(row, column) ¶Ç¦^³æ­ÓÀx¦s®æ¡A¨ä¤¤ row ¬°¦C¯Á¤Þ¡Acolumn ¬°Äæ¯Á¤Þ¡C

Ãø¹D§ó·sª©ªº Excel ¤¤,
Cells ¦³¨ä¥¦·sªº»yªk¶Ü?

TOP

¦^´_ 16# luhpro


    ³o´N¤£¤F¸Ñ¤F...¦]§Ú·íªì¶Kªº¨º¬q¬O¥i¥¿±`¹B§@~
«á¨Ó±Nªí®æ²Î¤@¦b¤@­Ó,´N¨S¦³¨Ï¥Î³o¬q«ü¥O¤F ,
§ï¨Ï¥Î¹³§AÁ¿ªº
­Y­n¤Þ¥Î§A 15# ©Ò­zªº Function,
¨º»ò¸Ó¦æ¤j¬ùÀ³¸Óªø¦¨©³¤U³o¼Ë :
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets(GetMonthStr(inDate))
¨Ï¥Î¬°
Set wsTarget = Workbooks("«È¤á©ú²Ó-«ÈªA±M¥Î.xlsm").Sheets("«È¤á©ú²Ó")
¥t·Q½Ð°ÝinDate¬O?

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2015-6-9 01:13 ½s¿è
¦^´_  luhpro
    ³o´N¤£¤F¸Ñ¤F...¦]§Ú·íªì¶Kªº¨º¬q¬O¥i¥¿±`¹B§@~
«á¨Ó±Nªí®æ²Î¤@¦b¤@­Ó,´N¨S¦³¨Ï¥Î ...
starry1314 µoªí©ó 2015-6-8 22:57

¨º­n¬Ý­ìÀɮפº®e¤~¯àª¾¹D¤F.


¥t·Q½Ð°ÝinDate¬O?
starry1314 µoªí©ó 2015-6-8 22:57

½Ð¬Ý 15 #
Function GetMonthStr(inDate As Date) As String
¦]¬°¤£¯à±oª¾§A©I¥s Function ®É¥Îªº¬O¤°»òÅܼƦWºÙ,
¦ÛµMª½±µ®M¥Î Function ¤WªºÅܼƦW¨Ó»¡©ú.

TOP

        ÀR«ä¦Û¦b : ¸Ü¦h¤£¦p¸Ü¤Ö¡A¸Ü¤Ö¤£¦p¸Ü¦n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD