2017-08-22 5 views
0

前の質問を検索しましたが、これらのコードはシート全体の最後の列に使用しますが、範囲内の最後の列なので、BDはまた、一度にコピー、私は、現在の月に式を残して、BDに特別な値を貼り付けたいBEと来月 最後の列のコピー式を範囲内の次の空白列にコピーし、現在の列のpastevalueにコピーします

enter image description here

BF

にされるようにコピーカラム。

常にシート全体の最後の列をコピーし、以下のコード..

Dim LastRow As Long 
Dim LastCol As Long 

LastRow = Cells(Rows.Count, "A").End(xlUp).Row 
LastCol = Cells(9, Columns.Count).End(xlToLeft).Column 

Cells(9, LastCol).Resize(LastRow - 8).Copy Cells(9, LastCol + 1) 

すべてのあなたの助けと時間に感謝。

答えて

0

変更Columns.Count"BJ"にこれは、列遠いから列BJにシート上の右に最後の列の開始点を変更し、それが値を持つ最初のセルを探して左に行きます。

Dim LastRow As Long 
Dim LastCol As Long 

LastRow = Cells(Rows.Count, "A").End(xlUp).Row 
LastCol = Cells(9, "BJ").End(xlToLeft).Column 

Cells(9, LastCol).Resize(LastRow - 8).Copy Cells(9, LastCol + 1) 
関連する問題