|
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim i%, s$
- i = ActiveCell.Row: If i < 3 Then ActiveSheet.Buttons("CreateMe").Visible = False: Exit Sub
- Ckbtn
- With ActiveSheet.Buttons("CreateMe")
- If Cells(i, "b") = "" Then .Visible = False: Exit Sub
- .Visible = True
- .Top = Cells(i, "b").Top
- .Left = Cells(i, "b").Left
- .Width = Cells(i, "b").Width
- .Height = Cells(i, "b").Height
- .Caption = Cells(i, "b").Value
- End With
- End Sub
复制代码
- Private Sub Ckbtn()
- Dim cb As Boolean
- With Sheets(1)
- j = .Buttons.Count
- For i = 1 To j
- If .Buttons(i).Name = "CreateMe" Then cb = True
- Next
- If Not cb Then
- Dim rng As Range
- Set rng = .Cells(2, "b")
- Set btn = .Buttons.Add(rng.Left, rng.Top, rng.Width, rng.Height)
- With btn
- .Name = "CreateMe"
- .Caption = rng.Value
- .Characters.Font.Size = 9
- .OnAction = "zz"
- End With
- Set rng = Nothing
- Set btn = Nothing
- End If
- End With
- End Sub
复制代码
- Private Sub zz()
- Dim ar, i&, n%, s$, a
- i = ActiveCell.Row
- ar = Range("b" & i & ":aa" & i).Value
- For j = 5 To UBound(ar, 2) - 2
- If Len(ar(1, j)) Then s = s & "|" & ar(1, j): n = n + 1
- Next
- a = Application.Transpose(Split(Mid(s, 2), "|"))
- Sheets(2).Copy
- For i = 1 To n
- Cells(5 + i, 1) = i
- Next
- [b6].Resize(1, 3) = ar
- For j = 2 To 4
- Cells(6, j).Resize(n).Merge
- Next
- Cells(6, j).Resize(n) = a
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|