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

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

¦^´_ 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

¦^´_ 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

¦^´_ 12# ML089

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

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

¦^´_ 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

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