返回列表 上一主題 發帖

[發問] 註解的方式

回復 1# vicky12060709

試試看
Sheet35,(PE袋) 模組的程式碼 (工作表預設)
  1. Option Explicit
  2. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  3.     Dim xText As String, Rng As Range, i As Integer, e As Variant
  4.     With Target
  5.             If .MergeCells Then  '是合併儲存格
  6.                 If .Rows.Count >= 4 And .Cells(1).Column = 14 Then  '有4個以上儲存格 且在 N欄
  7.                     Set Rng = Range("A" & .Rows(1).Row)                    '設定A欄的位置
  8.                     xText = "無限使用:" & vbLf
  9.                     For i = 1 To .Rows.Count
  10.                         For Each e In Array("B", "C", "F", "G", "K")         'B5&C5 &F5&@G5&K5&*1.13----能
  11.                             xText = xText & " " & IIf(e = "G", "@", "") & Rng.Range(e & i)
  12.                         Next
  13.                         xText = xText & "*1.13" & vbLf
  14.                     Next
  15.                     With Target.Cells(1)
  16.                             If .Comment Is Nothing Then .AddComment
  17.                             With .Comment
  18.                                     .Text xText
  19.                                     .Shape.TextFrame.AutoSize = True   '自動調整
  20.                             End With
  21.                     End With
  22.                 End If
  23.            End If
  24.     End With
  25. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 靜坐常恩己過、閒談莫論人非。
返回列表 上一主題