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

[µo°Ý] ¬dÀË ©w¸q¦WºÙ ¥Î¦b¤u§@ï­þ¤@¨ÇÀx¦s®æ¤½¦¡

[µo°Ý] ¬dÀË ©w¸q¦WºÙ ¥Î¦b¤u§@ï­þ¤@¨ÇÀx¦s®æ¤½¦¡

½Ð°Ý¤j«L  

¬Y¤@Àx¦s®æ©w¸q¦WºÙ¬° "myName"¡A¦³®Ä½d³ò "¤u§@ï" ¦Ó³Q¥Î¦b ¤u§@ï("myBook")ªº¨ä¥L"¤u§@ªí" (mySh1, mySh2, ... myShN)¤º¡C
¤§«á¡A¨Ï¥Î¤½¦¡ªº°lÂܱqÄÝ°Ñ·Ó¥u¯à¦b³Q©w¸qªº¤u§@ªí²M·¡ªº°lÂÜ¡A¦b¨ä¥Lªº¤u§@ªí¤º ´N«Ü¤£¤è«Kªº¤@­Ó­Ó¦a§ä¡C
¸Ó¦p¦ó²M´·ªº¨ãÅé¦a¦b¨ä¥L¤u§@¤º"°lÂÜ"ªº¨ì?
1. ¦b¤u§@ªíªº¾Þ§@¡A
2. ¥ÎVBA ªº¤èªk¡C

·P®¦

¦^´_ 1# Scott090
  1. Sub Ex()
  2. MsgBox Range("test").Address(, , , 1)
  3. With ThisWorkbook.Names("test")
  4.    MsgBox "RefersTo " & .RefersTo
  5.    MsgBox "RefersToLocal " & .RefersToLocal
  6.    MsgBox "RefersToR1C1 " & .RefersToR1C1
  7.    MsgBox "RefersToR1C1Local " & .RefersToR1C1Local
  8.    MsgBox "RefersToRange " & .RefersToRange
  9. End With
  10. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ÁÂÁÂ
Sub Ex()
MsgBox Range("test").Address(, , , 1)
With ThisWorkbook.Names("test")
   MsgBox "RefersTo " & .RefersTo

End With
End Sub
³o­Ó½X·|¨ú¥X "test" ³o­Ó©w¸q¦WºÙ ³Q©w¸q¦b ¨º¤@­ÓÀx¦s®æ
§Ú§Æ±æÀ°¦£ªº¬O§ä¥X "test" ³Q¥Î¦b­þ¤@¨Ç¤u§@ªíªº¨º¤@¨ÇÀx¦s®æ¡G
¨Ò¦p»¡  "test" ³Q©w¸q¦b mySh1!$AE$14
              ¤w³Q¥Î¦b mySh1ªº A4 (=6+test), A20 (10*test) ,A32 (=test/3)¡B
                                          mySh3 ªº AB7 (= test^2)¡B
                                         mySh4ªº B7, B38 ....¡F
         ¦p¦ó§ä¥X³o¨ÇÀx¦s®æ¦³¥Î¨ì "test" ?
              µª®×¬O mySh1!$A$4, mySh1!$A$20 .......

¦A·P®¦

TOP

¦^´_ 3# Scott090
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Rng As Range, Rng_address As String, Sh As Worksheet, Name_Range As String
  4.     With ThisWorkbook
  5.         For Each Sh In .Sheets
  6.             Set Rng = Sh.Cells.Find(What:="Test", LookIn:=xlFormulas, LookAt:=xlPart)
  7.             If Not Rng Is Nothing Then
  8.                 Rng_address = Rng.Address
  9.                 Do
  10.                     Name_Range = Name_Range & vbLf & Rng.Address(, , , 1)
  11.                     Set Rng = Sh.Cells.FindNext(Rng)
  12.                 Loop While Rng_address <> Rng.Address
  13.             End If
  14.         Next
  15.         Name_Range = Mid(Name_Range, 2)
  16.         Name_Range = Replace(Name_Range, "[" & .Name & "]", "")
  17.         MsgBox Name_Range
  18.    End With
  19. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE

¤w¸g¸Ñ¨M¤F°ÝÃD

·P®¦«ü¾É

TOP

        ÀR«ä¦Û¦b : ºw¤ô¦¨ªe¡C²É¦Ì¦¨ÅÚ¡A¤Å»´¤vÆF¡A¤Å¥Hµ½¤p¦Ó¤£¬°¡C
ªð¦^¦Cªí ¤W¤@¥DÃD