2020-06-18から1日間の記事一覧

ExcelVBAでリストボックスで選択された項目名を取得

Private Sub CommandButton1_Click() With ListBox1 If .ListIndex = -1 Then MsgBox "未選択です。" Else MsgBox .List(.ListIndex, 0) End If End With End Sub ネタ元 https://kosapi.com/post-4033/

ExcelVBAでブックの一覧を取得

Sub Sample1() Dim i As Long, tmp As String For i = 1 To Workbooks.Count tmp = tmp & Workbooks(i).Name & vbCrLf Next i MsgBox "現在開いているブックは、" & vbCrLf & tmp & "です" End Subもしくは Sub Sample2() Dim wb As Workbook, tmp As String…