如何获得ListBox1.Selected(i)位置和更改样式?

时间:2018-04-23 05:49:11

标签: excel vba excel-vba

我需要自动将位置rigth中的按钮添加到列表框中的选定项目。

在Excel工作表中

添加按钮,如

Sub buttonsAdd()
   Dim btn As Button
   Dim t As Range
   LastRow = wsAuth.Cells(wsAuth.Rows.count, "A").End(xlUp).row
   wsAuth.Buttons.Delete       
   For i = 1 To LastRow
     Set t = wsAuth.Range(wsAuth.Cells(i, 6), wsAuth.Cells(i, 6))
     Set btn = wsAuth.Buttons.add(t.Left, t.Top, t.Width, t.Height)
     With btn
        .OnAction = "btnS"
        .Caption = SignInButCaption & wsAuth.Cells(i, 1).Value
        .Name = "Btn" & i
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlCenter
        .AutoSize = False
     End With
   Next i
End Sub

有没有办法在与listbox.selected(i)相同的位置向userform添加按钮?
是否可以更改listbox.selected(i)字体大小和样式?

0 个答案:

没有答案
相关问题