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

¦b½d³ò¤º´M§ä«ü©w¤º®eªº¦ì¸m

¦b½d³ò¤º´M§ä«ü©w¤º®eªº¦ì¸m

½Ð°Ý¦p¦ó¥i¥H¦b«ü©wÀx¦s®æ½d³ò(¨Ò¦p¦bA1:D5),
§ä¨ì«ü©w¤º®e(¦p "TARGET" )ªºÀx¦s®æ¦ì¸m
½Ð«ü±Ð

¦^´_ 1# enoch
  1. Sub sh()
  2.     For ghps = 1 To 5
  3.         For gg = 1 To 4
  4.             If Cells(ghps, gg) = "TARGET" Then
  5.                 Cells(ghps, 11) = "Y=" & ghps & "X=" & gg
  6.             End If
  7.         Next gg
  8.     Next ghps
  9. End Sub
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦hÁ«ü±Ð, ©l²×­n¨C¦æ¥h§ä´M

TOP

¦^´_ 3# enoch
  1. Sub ex()
  2. If Application.CountIf(Range("A1:D5"), "TARGET") > 0 Then
  3. Range("A1:D5").Replace "TARGET", "=1/0", xlWhole
  4. Set A = Range("A1:D5").SpecialCells(xlCellTypeFormulas, 16)
  5. MsgBox A.Address
  6. A.Value = "TARGET"
  7. End If
  8. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2012-9-29 22:44 ½s¿è
  1. Dim A As Range
  2. With Range("A1:D5")
  3.     Set A = .Find(what:="TARGET", After:=.Cells(1, 1))
  4. End With
  5. MsgBox A.Address
½Æ»s¥N½X

TOP

¦^´_ 1# enoch
¸Õ¸Õ³o­Ó¡A³o¬O§Ú±`¨Ï¥Îªº¥\¯à¨ç¦¡¡C
  1. Function getTarget(sh As String, rng As String, fnd As Variant) As String
  2.       Dim c As Range
  3.    
  4.      Set c = Sheets(sh).Range(rng).Find(fnd, LookIn:=xlValues, LookAt:=xlWhole)
  5.      If Not c Is Nothing Then
  6.             getTarget = c.Address
  7.      End If
  8. End Function
½Æ»s¥N½X

TOP

¦^´_ 1# enoch
§Ú§Ñ¤Fªþ¤W½d¨Ò¡C
  1. Sub Test()
  2.     Dim adr As String
  3.    
  4.     adr = getTarget("¤u§@ªí1", "A1:D5", "TARGET")
  5.     MsgBox adr
  6. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# enoch
¹ê°È¤W¡A·¥¦³¥i¯à·|»Ý­n¥h¨ú±o(©Î§ä¨ì) "¼Ðªº" ¥kÃ䪺­È¡A
§A¤]¥i¥H¨Ï¥Î¦¹¥\¯à²[¦¡¹F¨ì¥Øªº¡C
  1. Sub Test()
  2.     Dim adr As String
  3.    
  4.     adr = getTarget("¤u§@ªí1", "A1:D5", "TARGET")
  5.     MsgBox adr
  6.     adr = getTarget("¤u§@ªí1", "A1:D5", "TARGET", False)
  7.     MsgBox adr
  8.     [A6] = Range(adr).Value
  9. End Sub

  10. Function getTarget(sh As String, rng As String, fnd As Variant, Optional curr As Boolean = True) As String
  11.     Dim c As Range
  12.    
  13.     Set c = Sheets(sh).Range(rng).Find(fnd, LookIn:=xlValues, LookAt:=xlWhole)
  14.     If Not c Is Nothing Then
  15.         getTarget = IIf(curr, c.Address, c.Offset(, 1).Address)
  16.     End If
  17. End Function
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD