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

[µo°Ý] ¨Ï¥ÎVBA±N¤½¦¡¥H¤å¦r«¬ºA©ó­ì¦ì¸mÅã¥Ü

[µo°Ý] ¨Ï¥ÎVBA±N¤½¦¡¥H¤å¦r«¬ºA©ó­ì¦ì¸mÅã¥Ü

¨Ï¥ÎVBA±N¤½¦¡¥H¤å¦r«¬ºA©ó­ì¦ì¸mÅã¥Ü

Àɮפº¦³½d¨Ò¤Î»¡©ú
¨Ï¥ÎVBA±N¤½¦¡¥H¤å¦r«¬ºA©ó­ì¦ì¸mÅã¥Ü.rar (4.28 KB)
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

¦^´_ 13# stillfish00

¤£¦n·N«ä¡A¦h®æ°}¦C¤½¦¡ ¤w¸g¥i¥H¤F¡ACurrentArray.Count³o«ü¥O¥i¥H
¦]¬°´ú¸ÕÀɮפw¸g³Q§ï¹L¨Sª`·N¨ì


«áÄò§@·~§¹µ{«á
ÁÙ­n¥t¤@­Óµ{¦¡°õ¦æ¡A±N³o¨Ç "¤å¦r¤½¦¡" Âର¤½¦¡Àx¦s®æ

¦A³Â·ÐÀ°¦£¤@¤U
PS:¦³¨Ç®æ¦¡¥i¯à»Ý­n½Õ¾ã¡A
³æ®æ°}¦C¤½¦¡ {...} OK
¦h®æ°}¦C¤½¦¡ [...] OK ¡A¦ý¦p¦ó¨Ó§PÂ_¥Lªº½d³ò?
¤@¯ë¤½¦¡ '=.... ¥i¯à·|»P­ì¦³¤å¦r¤½¦¡½Ä¬ð¡A©Î³\±N§ï¬° '@=....«e2¦r¤¸ "@=" ¨Ó§P§O
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 13# stillfish00

CurrentArray.Count ³o­Ó«ü¥O³æ¿W´ú¸Õ¬OOKªº¡A¤£ª¾§Ú´N¬O¶]¤£¥X¨Ó

§Ú¦bµ{¦¡¸Ì¥[ Debug.Print¡A¨Ã¨S¦³³Q°õ¦æ¨ì¡A¤£ª¾°ÝÃD¦b­þ¸Ì

If C.CurrentArray.Count > 1 Then
            C.CurrentArray.Value = "[" & C.FormulaArray & "]"
            Debug.Print "[" & C.FormulaArray & "]"
Else
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 12# ML089

¤£¦æ¶Ü?
§Ú¶]7#ªº·s½d¨Ò¡AHÄæ¬O¦³¤À¥X¨Óªº

TOP

¦^´_ 11# stillfish00

ÁÂÁ§A¨¯­W¤F¡A
¤j³¡¤À¥i¥H¦ý ¦h®æ°}¦C¤½¦¡ ÁÙ¬O¨S¦³°Ï¤À¥X¨Ó

PS
¦h®æ°}¦C¤½¦¡ ¬O«ü¤½¦¡¿é¤J®É¤@¦¸¿ï¨ú¦hÀx¦s®æ¥Î CTRL+SHIFT+ENTER»ô«ö¿é¤J
¨Ò¦p:¤u§@ªí[¦h®æ°}¦C¤½¦¡]¤¤B2:J10¬O¤@¦¸¿ï¨ú¦P®É¿é¤J¤½¦¡ =A2:A10*B1:J1¡A¥H CTRL+SHIFT+ENTER»ô«ö¿é¤J
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 10# ML089
¸Õ¬Ý¬Ý³o¼Ë¥i¤£¥i¥H¡C
  1. Sub Test()
  2.   Dim C As Range, Sh As Worksheet
  3.   Dim fs
  4.   
  5.   fs = Application.GetOpenFilename("Excel Files (*.xls;*.xlsx;*.xlsm), *.xls;*.xlsx;*.xlsm") '¶}±ÒÀÉ®×
  6.   If StrComp(TypeName(fs), "String", vbTextCompare) <> 0 Then Exit Sub  '¨Ï¥ÎªÌ¨ú®ø¿ï¾ÜÀÉ®×
  7.   
  8.   
  9.   With Workbooks.Open(fs)
  10.     Application.EnableEvents = False
  11.    
  12.     For Each Sh In .Sheets
  13.       For Each C In Sh.UsedRange
  14.         If C.HasArray Then
  15.           If C.CurrentArray.Count > 1 Then
  16.             C.CurrentArray.Value = "[" & C.FormulaArray & "]"
  17.           Else
  18.             C.CurrentArray.Value = "{" & C.FormulaArray & "}"
  19.           End If
  20.         ElseIf C.HasFormula Then
  21.           C.Value = "'" & C.Formula
  22.         End If
  23.       Next
  24.     Next
  25.    
  26.     Application.EnableEvents = True
  27.   End With
  28.   
  29. End Sub
½Æ»s¥N½X

TOP

¦^´_ 8# Hsieh

­ì¨Ó¬O¤å¦r '=SUM(B2:M2) ·|Åܦ¨¤½¦¡
§Ú±N Mystr = C.C.Formula
§ï¬° Mystr = C.Value

{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 8# Hsieh

°õ¦æOK
¥u³Ñ ¦h®æ°}¦C¤½¦¡ ­n¥Î [ ] ¬A¦í¡A¥Î¨Ó°Ï§O»P³æ®æ°}¦C¤½¦¡¥Î { }  ¬A¦í

¦]¬°³Ì«áÁÙ­n±N³o¤å¦r¤½¦¡´_­ì¦¨¤½¦¡¡C
³ÌÃøªº´N¬O¦h®æ°}¦C¤½¦¡ªºÂà´«(¤½¦¡Âà¤å¦r¡A¤å¦r¦AÂà¦^¤½¦¡)¡A³o³¡¤À§Ú¦bºô¸ô¤W§ä«Ü¤[³£¨S¦³¬d¨ì¥i¥Îªº¡A
ÁÂÁ¶Wª©¤w¸g¸Ñ¨M¤@¥b¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 7# ML089
  1. Sub ex()
  2. Dim A As Range, C As Range, Sh As Worksheet
  3. fs = Application.GetOpenFilename("Excel Files (*.xls;*.xlsx;*.xlsm), *.xls;*.xlsx;*.xlsm") '¶}±ÒÂÂÀɹï¸Ü
  4. If fs <> False Then
  5. With Workbooks.Open(fs) '¶}±ÒÂÂÀÉ
  6. Application.EnableEvents = False
  7. For Each Sh In .Sheets
  8. With Sh
  9. ar = .UsedRange
  10.    For i = 1 To UBound(ar, 1)
  11.       For j = 1 To UBound(ar, 2)
  12.          Set C = .UsedRange.Cells(i, j)
  13.          If C.HasArray Then
  14.             Mystr = "{" & C.Formula & "}"
  15.          ElseIf C.HasFormula Then
  16.             Mystr = "'" & C.Formula
  17.          Else
  18.             Mystr = C.Formula
  19.          End If
  20.          ar(i, j) = Mystr
  21.       Next
  22.    Next
  23. .UsedRange = ar
  24. End With
  25. Next
  26. Application.EnableEvents = True
  27. End With
  28. End If
  29. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 3# Hsieh
¦^´_ 2# stillfish00

¦³·sªº°ÝÃD
' 1. ·í¸Ó¤u§@ªí¨S¦³¤½¦¡®É·|²£¥Í¿ù»~
' 2. ¹J¨ì¦h®æ°}¦C¤½¦¡®É·|¶]«Ü¤[¤]·|¿ù»~
' 3. ³æ®æ°}¦C¤½¦¡®É«e«á¥Î {}¥]¦í, ¦h®æ°}¦C¤½¦¡®É«e«á¥Î []¥]¦í - ªí¥Ü

·sªº½d¨ÒÀÉ®×
¨Ï¥ÎVBA±N¤½¦¡¥H¤å¦r«¬ºA©ó­ì¦ì¸mÅã¥Ü.rar (13.41 KB)
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD