Wednesday, October 14, 2009

TO DELETE EVERY OTHER ROW AND JOIN TEXTS TOGETHER

in an unused column enter 1, x, 2, x in the first 4 rows, then use the fill handle as far down as necessary. The series will repeat, 3, x, 4, x, etc. Sort everything by this column and all the x's will be together. You can delete all these rows, then clear the column

To delete every other row:

Code:
Option Explicit

Sub Test()

Dim x As Long
Dim LastRow As Long

LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -2
Rows(x & ":" & x).Delete
Next x

End Sub
***********************************************************************************************
Joining Text Together
There are times where we import text file into Excel an we get text that are separated. I received an email asking how put these text together. Select across your cells first and run this macro.

Sub JoinText()
myCol = Selection.Columns.Count
For i = 1 To myCol
ActiveCell = ActiveCell.Offset(0, 0) & ActiveCell.Offset(0, i)
ActiveCell.Offset(0, i) = ""
Next i
End Sub

No comments:

Post a Comment