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

[µo°Ý] ½Ð°Ýoffset(ÅܼÆ)¸Ó¦p¦ó½s¼g

[µo°Ý] ½Ð°Ýoffset(ÅܼÆ)¸Ó¦p¦ó½s¼g

½Ð±Ð¦U¦ì¥ý¶i

Offset¬O§_¥i¥H¥ÎÅܼƱ±¨î©O¡H·Qªk¦p¤U¡I

¤p§Ì´ú¸Õ«á ©Ç©Çªº ½Ð±Ð°ª¤â ÁÂÁ¡I

x = "A1"

y = "0,0"
Sheet2.Range(x).Offset(y) = "A"

y = "1,3"
Sheet2.Range(x).Offset(y) = "B"

y = "3,1"
Sheet2.Range(x).Offset(y) = "C"

¦^´_ 1# lifedidi
¹Bºâ¦¡  Offset(RowOffset, ColumnOffset)
RowOffset   
   ¿ï¥Î Variant ¸Ó½d³ò­n¦ì²¾ªº¦C¼Æ¡A
   ¥i¬°¥¿­È¡B­t­È©Î 0 (¹s)¡C¥¿­Èªí¥Ü¦V¤U¦ì²¾¡A
   ­t­Èªí¥Ü¦V¤W¦ì²¾¡C¹w³]­È¬° 0¡C
ColumnOffset
   ¿ï¥Î Variant ¸Ó½d³ò­n¦ì²¾ªºÄæ¼Æ¡A
   ¥i¬°¥¿­È¡B­t­È©Î 0 (¹s)¡C¥¿­Èªí¥Ü¦V¥k¦ì²¾¡A
   ­t­Èªí¥Ü¦V¥ª¦ì²¾¡C¹w³]­È¬° 0¡C

¥H§A¥Ø«e¤§½d¨Ò¼Ò¦¡¬°¸ÑÃD¡G
  1. Sub Test()
  2.     Dim x As String, y As String
  3.    
  4.     x = "A1"

  5.     y = "0,0"
  6.     ' ¿ù»~¤Þ¥Î¡G Sheet2.Range(x).Offset(y) = "A"
  7.     Sheet2.Range(x).Offset(Val(y), Val(Mid(y, InStr(y, ",") + 1))) = "A"
  8.    
  9.     y = "1,3"
  10.     ' ¿ù»~¤Þ¥Î¡G Sheet2.Range(x).Offset(y) = "B"
  11.     Sheet2.Range(x).Offset(Val(y), Val(Mid(y, InStr(y, ",") + 1))) = "B"
  12.    
  13.     y = "3,1"
  14.     ' ¿ù»~¤Þ¥Î¡G Sheet2.Range(x).Offset(y) = "C"
  15.     Sheet2.Range(x).Offset(Val(y), Val(Mid(y, InStr(y, ",") + 1))) = "C"
  16. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# lifedidi
  1. Option Explicit
  2. Sub Test()
  3.     Dim x As String, y As Variant
  4.     x = "A1"
  5.     y = "0,0"
  6.     y = Split(y, ",")
  7.     Sheet2.Range(x).Offset(y(0), y(1)) = "A"
  8.     y = "1,3"
  9.     y = Split(y, ",")
  10.     Sheet2.Range(x).Offset(y(0), y(1)) = "B"
  11.     y = "3,1"
  12.     y = Split(y, ",")
  13.     Sheet2.Range(x).Offset(y(0), y(1)) = "C"
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2014-4-1 08:39 ½s¿è

¦^´_ 1# lifedidi
¦^´_ 3# GBKEE
À³¥Î y = Split(y, ",") §ó²¼ä¡A¥ç¬O¤£¿ùªº¤Þ¥Î¡I

TOP

¦^´_ 1# lifedidi
§Ú·Q §Aªº°ÝÃD¬O·Q¦ì²¾¦V¤U a ¦V¥k b
        sheets("TEST").cells(i,j).offset(a,b)="¸Õ¸Õ¬Ý1"
¦¹®É i,j,a,b §¡¥i¬°ÅܼÆ
        sheets("TEST").cells(i,j).offset(,b)="¸Õ¸Õ¬Ý2"
ªÅ¥Õªí¥Üºû«ù­ì¦C©Î­ìÄæ
        ¤£ª¾¦³§_À°§U

TOP

        ÀR«ä¦Û¦b : ¤p¨Æ¤£°µ¡B¤j¨ÆÃø¦¨¡C
ªð¦^¦Cªí ¤W¤@¥DÃD