[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]
『マクロでのセルの移動』(みーくん)
マクロ初心者です。
毎回決まったフォーマットでエクセルに出力されるデータがあります。
行数は毎回変わります。J列とK列の最後二行二列に入るのセルの内容を
F列G列へ移動させるにはどのようにしたらいいでしょう。
(下は省略してありますが、A1からJ54まで別データが入ってるとします)
A B C- 略 - F G H I J K 1 略 55 あい 56 うえ
A B C- 略 - F G H I J K 1 略 55 あい 56 うえ
< 使用 Excel:Excel2013、使用 OS:Windows7 >
Range("J55:K56").Select
Selection.Cut Range("F55").Select ActiveSheet.Paste (unko) 2017/06/09(金) 15:45
(みーくん) 2017/06/09(金) 15:56
列位置がわかりづらいけど
Sub test() With Columns("j:k").SpecialCells(2).Areas With .Item(.Count) .Copy .Offset(, -4) .ClearContents End With End With End Sub (seiya) 2017/06/09(金) 16:08
Cells(Rows.Count, 6).End(xlUp) = Cells(Rows.Count, 10).End(xlUp)
Cells(Rows.Count, 6).End(xlUp).Offset(-1) = Cells(Rows.Count, 10).End(xlUp).Offset(-1)
Cells(Rows.Count, 6).End(xlUp).Offset(1) = Cells(Rows.Count, 10).End(xlUp).Offset(1)
Cells(Rows.Count, 6).End(xlUp).Offset(1, -1) = Cells(Rows.Count, 10).End(xlUp).Offset(1, -1)
(らら) 2017/06/09(金) 16:19
>A1からJ54まで別データが入ってるとします ↑見逃し...
Sub test() With Range("j" & Rows.Count).End(xlUp)(0).Resize(2, 2) .Copy .Offset(, -4) .ClearContents End With End Sub (seiya) 2017/06/09(金) 16:22
(みーくん) 2017/06/09(金) 17:09
[ 一覧(最新更新順) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.