|
今一意味が?ですがこんな事かな?
Option Explicit
Private Sub UserForm_Initialize()
With ListBox1
.ColumnCount = 2
.ColumnWidths = "27;27"
.ColumnHeads = True
.RowSource = "A8:B" & Cells(Rows.Count, 2).End(xlUp).Row
.ControlSource = "G7"
' .BoundColumn = 1
' .BoundColumn = 2
.BoundColumn = 0
End With
End Sub
Private Sub CommandButton1_Click()
' Range("D" & 65536).End(xlUp).Offset(1) = ListBox1.Value
' Range("E" & 65536).End(xlUp).Offset(1) = ListBox1.Value
'→E列にBoundColumn = 2のデータを貼り付けたいのですが・・・
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'どのようにコードを書けばよいでしょうか?
Dim rngMark As Range
Set rngMark = Range("D" & 65536).End(xlUp).Offset(1)
With ListBox1
rngMark.Value = .List(.ListIndex, 0)
rngMark.Offset(, 1).Value = .List(.ListIndex, 1)
End With
Set rngMark = Nothing
End Sub
|
|