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

[µo°Ý] ½Ð°Ý¤£¦P¤u§@ªíªºÅܼƦp¦ó³]¡H

[µo°Ý] ½Ð°Ý¤£¦P¤u§@ªíªºÅܼƦp¦ó³]¡H

¦U¦ì¥ý¶i¤j®a¦n¡A¤p§Ì¤S¨Ó¥´ÂZ¤F¡C¤S¦³°ÝÃD¨D§U¡C§Úªº¦¨ÁZ¨t²Î²Ä¤@­Ó¤u§@ªí¬O³]©w¤ñ¨Ò¡A²Ä¤G­Ó¤u§@ªí¬O¶ñ¤J¦¨ÁZ¡C²Ä¤T­Ó«h¬O¦¨ÁZÁ`ªí¡C°ÝÃD¬O¡G°²³]°ê»y
ªº¥[Åv¤ñ¨Ò¬Osheet1 c2³o¤@®æ¡A°ê»y¦¨ÁZ¿é¤JÄæ¬Osheet2  c3³o¤@®æ¡A¦¨ÁZ³æ°ê»yÄæ¬Osheet3  c5 ¡A½Ð°Ý1.³oºØ¸ó¤u§@ªíÅܼƪº»yªk­n«ç»ò¼g¡A³Â·Ð¦U¦ì¤F¡]§Úª¾¹Dºâ¦¡«ç»ò¼g¡A¦ý¬O¤£¦P¤u§@ªí«h¤£À´¡^¡I2.³oºØ»yªk¬O¤£¬OÀ³¸Ó¼g¦bsheet2 ªº worksheet_change ©O¡H¸U¤À·PÁ¡I

... ³oºØ¸ó¤u§@ªíÅܼƪº»yªk­n«ç»ò¼g ...
skyutm µoªí©ó 2012-8-22 22:43


Àx¦s®æªº¤Þ¥Î¥i¥H¥Î¦n´XºØ¤è¦¡,
©³¤UÁ|´X­Ó¤ñ¸û²³æ©ö¥Îªº:
1. Sheet¦WºÙ.[Àx¦s®æ]
¨Ò :  Sheet1.[c2] = 120 '¥[Åv¤ñ¨Ò
     Sheet2.[c3] = 86 '°ê»y¦¨ÁZ¿é¤JÄæ
     Sheet3.[c5] = Sheet2.[c3] '¦¨ÁZ³æ°ê»yÄæ

2. Sheets("¤u§@ªí¦WºÙ").Cells(Àx¦s®æ¦C§Ç, Àx¦s®æÄæ§Ç)
  Sheets("Sheet1").Cells(2, 3) = 120 '¥[Åv¤ñ¨Ò
  Sheets("Sheet2").Cells(3, 3) = 86 '°ê»y¦¨ÁZ¿é¤JÄæ
  Sheets("Sheet3").Cells(5, 3) = Sheets("Sheet2").Cells(3, 3) '¦¨ÁZ³æ°ê»yÄæ

3. ³]©w Sheet «ü¼Ð, µM«á¥H«ü¼Ð¥N´À Sheet ¦WºÙ¨Ó¤Þ¥Î
  Dim sh1 As Sheet1, sh2 As Sheet2, sh3 As Sheet3
  
  Set sh1 = Sheet1
  Set sh2 = Sheet2
  Set sh3 = Sheet3
  
  sh1.Range("c2") = 120  '¥[Åv¤ñ¨Ò
  sh2.Range("C3") = 86  '°ê»y¦¨ÁZ¿é¤JÄæ
  sh3.Range("C5") = sh2.Range("c3")   '¦¨ÁZ³æ°ê»yÄæ

¤W­z¤è¦¡¤¤, Sheet ¤Þ¥Î¤è¦¡»P Àx¦s®æ ¤Þ¥Î¤è¦¡³£¥i¥H¤¬¬Û¥N´«,
¨Ò¦p§A¥i¥H¥Î
Sheet1.Cells(2, 3) = 120 '¥[Åv¤ñ¨Ò

³o¸Ì­n²¤·L´£¤@¤U Office »¡©ú¤¤¤£¤Íµ½ªº¦a¤è, (§Ú¥Îªº¬O 2003 ª©)
­Y§Ú­Ì¥Î ¤u§@ªí ©Î Àx¦s®æ ¨Ó·j´M¬ÛÃöªº¨Ï¥Î¤è¦¡,
·|µo²{§ä¤£¨ì·Q­nªº»¡©ú,
¦Ó­n¥Î Range ©Î Sheets ¤~¯à (­Y¥Î Sheet ¤]¤£¯à) §ä¨ì ¨Ï¥Î Range ª«¥ó°Ñ·ÓÀx¦s®æ ©Î ¨Ï¥Î¦WºÙ°Ñ·Ó¤u§@ªí ¤§Ãþªº»¡©ú,
§Ú­è¾Ç²ß Excel VBA ®É©¹©¹®ö¶O«Ü¦h®É¶¡¦b§ä·Q­n¬Ýªº»¡©ú»P½d¨Ò,
¦³®ÉÁÙ¯uªºº¡®e©öÅý¤H¬ª®ðªº.

TOP

¦^´_ 1# skyutm
  1. '«Å§iÅܼƬ°¤½¥ÎÅܼÆ,¥i¦b¥ô¦ó¼Ò²Õ¤¤©I¥s
  2. '¦¹¤½¥ÎÅܼƦp¦bª«¥ó¼Ò²Õ¤¤,©ó¨ä¥L¼Ò²Õ¤¤©I¥s¶·¥[¤W¼Ò²Õ¦WºÙ  ¦p  Sheet1.¥[Åv¤ñ¨Ò
  3. '¦¹¤½¥ÎÅܼƦp¦b¤@¯ë¼Ò²Õ¤¤,©ó¨ä¥L¼Ò²Õ¤¤©I¥s¤£¶·¥[¤W¼Ò²Õ¦WºÙ¦p  ¥[Åv¤ñ¨Ò

  4. Option Explicit
  5. Public ¥[Åv¤ñ¨Ò As Range
  6. Public °ê»y¦¨ÁZ As Range
  7. Public ¦¨ÁZ³æ°ê»y As Range
  8. Sub Ex()
  9.     Set ¥[Åv¤ñ¨Ò = Sheet1.[c2]
  10.     Set °ê»y¦¨ÁZ = Sheet2.[c3]
  11.     Set ¦¨ÁZ³æ°ê»y = Sheet3.[c5]
  12. End Sub
½Æ»s¥N½X

TOP

·PÁ¨â¦ì¥ý¶i¡A¤p§Ì¦¹¶¥¬qªº»yªk¤w¸g§¹¦¨¡A¦A¦¸·PÁ¡I

TOP

        ÀR«ä¦Û¦b : ¦³¦h¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD