Last active
May 6, 2019 19:54
-
-
Save hedgejanuary/736e02aa00c6be2c61aaea249f3943d1 to your computer and use it in GitHub Desktop.
Cleaning up excel data (2 columns)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub CleanUpData() | |
Dim i As Long | |
Dim LastRow As Long | |
'空白行を削除 | |
Range("A:A").Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete | |
'データの最終行 | |
LastRow = Cells(Rows.Count, "A").End(xlUp).Row | |
'1行目から最終行までIf以下を繰り返す | |
For i = 1 to LastRow | |
'偶数行の場合は、値をB列に移動させる | |
If i Mod 2 = 0 Then | |
Cells(i, "A").Cut Cells(i-1,"B") | |
End if | |
Next i | |
'もう一回、空白行を削除 | |
Range("A:A").Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete | |
End Sub() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment