2017-01-11 17 views
1

:一行alwyas選択下に、列C、Dに、E、Fの貼り付け値

マイコード:

Dim addme as Range 
Set addme = Application.Selection 

    For x = 0 To Me.lbsourceList.ListCount - 1 
     If Me.lbsourceList.Selected(x) Then   

      'addme.Offset(1,) = Me.lbsourceList.List(x, 1)' 
      'addme.Offset(1,) = Me.lbsourceList.List(x, 2)' 
      'addme.Offset(1,) = Me.lbsourceList.List(x, 3)' 
      'addme.Offset(1,) = Me.lbsourceList.List(x, 4)' 

      Set addme = addme.Offset(1, 0)  
     End If 
    Next x 

オフセット(1,0)は1行下になりますが、C、D、E、F列の設定方法はわかりません。

答えて

1

編集1

Dim addme As Range Set addme = Selection ' set the range to selection's row, but in Column C Set addme = Cells(Selection.Row, "C") ' now offset 1 row below addme.Offset(1) = "test offset" 
C.

SelectionOffset作業を取得するために、以下のコードを試してみてください、しかしカラムで:POの新しいデータに合わせて更新されたコード:

Range(Cells(addme.Row, "C"), Cells(addme.Row, "C")).Offset(1).Value = Me.lbsourceList.List(x, 1) 
Range(Cells(addme.Row, "D"), Cells(addme.Row, "D")).Offset(1).Value = Me.lbsourceList.List(x, 2) 
Range(Cells(addme.Row, "E"), Cells(addme.Row, "E")).Offset(1).Value = Me.lbsourceList.List(x, 3) 
Range(Cells(addme.Row, "F"), Cells(addme.Row, "F")).Offset(1).Value = Me.lbsourceList.List(x, 4) 
+0

何II他の値を列D、列Eの横に貼り付ける必要があります...私はいくつかのaddmeをセットアップする必要がありますか? – 4est

+0

このコードはあなたのポストに答える、もしあなたが詳細を知りたいならあなたの投稿を更新する –

+0

あなたは歓迎です:) –

関連する問題