ªð¦^¦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¤½¦¡

¦^´_ 1# ML089
  1. Sub TEST()
  2.   Dim ar()
  3.   Dim rngSrc As Range
  4.   
  5.   With Sheets(1)
  6.     Set rngSrc = .Range("A1:O6")
  7.    
  8.     ReDim ar(1 To rngSrc.Rows.Count, 1 To rngSrc.Columns.Count)
  9.     For i = 1 To UBound(ar)
  10.       For j = 1 To UBound(ar, 2)
  11.         If rngSrc.Cells(i, j).HasArray Then
  12.           ar(i, j) = "{" & rngSrc.Cells(i, j).FormulaArray & "}"
  13.         ElseIf rngSrc.Cells(i, j).HasFormula Then
  14.           ar(i, j) = "'" & rngSrc.Cells(i, j).Formula
  15.         Else
  16.           ar(i, j) = rngSrc.Cells(i, j).Value
  17.         End If
  18.       Next
  19.     Next
  20.    
  21.     rngSrc.Copy
  22.     With .[A9]
  23.       .PasteSpecial Paste:=xlPasteFormats '®æ¦¡
  24.       .Resize(UBound(ar), UBound(ar, 2)).Value = ar
  25.     End With
  26.   End With
  27. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# ML089
  1. Sub ex()
  2. Dim A As Range
  3. For Each A In Cells.SpecialCells(xlCellTypeFormulas)
  4. If A.HasArray Then A = "{" & A.FormulaLocal & "}" Else A = "'" & A.FormulaLocal
  5. Next
  6. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# stillfish00

ÁÂÁ¨³³t¦^ÂСA¾Ç²ß¨ì«Ü¦h«ü¥O»P§Þ¥©

§Æ±æÄ~Äò«ü¾É¤@¤U

©µ¦ù¸ß°Ý 1
1. ¤½¦¡¤å¦r¬O­n¼g¦^­ìÀx¦s®æ¦ì¸m
2. ­n¯à¿ï¨ú¬Y­Ó¤u§@ï(©Î¬Y¤@­ÓÀÉ®×)
3. ¤u§@ï¸Ì­±¥]§t¤£©w¼Æ¤u§@ªí¡A­n±N©Ò¦³¤u§@ªí¸Ì¦³Ãö¤½¦¡¥þ³¡§ï¬°¤å¦r«¬ºA(°}¦C¤½¦¡«e«á¥[ {...} )
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 3# Hsieh

ÁÂÁÂ
Cells.SpecialCells(xlCellTypeFormulas) ³o­Ó¥i¥H¥u¿ï¨ì¤½¦¡°Ï¡A¯u±j

¤U­±´X­Ó«ü¥O§A»Pstillfish00¤Uªº¤è¦¡¤£¦P¡A³o¦³®t§O(©Î­nª`·Nªº±¡ªp¶Ü)¶Ü?
.FormulaLocal
.FormulaArray
.Formula

³Â·Ð¦A¬Ý3¼Ó·sªº©µ¦ù°ÝÃD¡AÁÂÁÂ
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 3# Hsieh

§Ú§ï¼g§ì¥þ³¡¤u§@ªí«á¡A¹J¨ì¨S¦³¤u§@ªí¤º¨S¦³¤½¦¡®É´N·|¿ù»~¡A­n¦p¦óÁקK
  1. Sub ex00()
  2.     Dim A As Range
  3.     For Each sh In Sheets
  4.     For Each A In sh.Cells.SpecialCells(xlCellTypeFormulas)
  5.         If A.HasArray Then
  6.            A = "{" & A.FormulaLocal & "}"
  7.         Else
  8.            A = "'" & A.FormulaLocal
  9.         End If
  10.     Next
  11.     Next
  12. End Sub
½Æ»s¥N½X
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

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

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

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

¦^´_ 8# Hsieh

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

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

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD