Hi Excel Experts,
I'm Des newbie to excel 2007 VB programming.
Need some help with looping. Like check column A last row is empty then exit loop. If cells from column A row 5 is not empty Concatenate all the cells from column A to column H until the last row is empty.
Output all information to a new sheet and save it into a .txt format. An example shown below.
GIMT 11 10 04 06 01 HLXU1234567 12345678
GOMT 11 10 04 06 02 HLXU1234568 12345679
GIFU 11 10 04 06 03 HLXU1234569 12345680
GOFU 11 10 04 06 04 HLXU1234570 12345681
LOMT 11 10 04 06 05 HLXU1234571 12345682
DIMT 11 10 04 06 06 HLXU1234572 12345683
LOFU 11 10 04 06 07 HLXU1234573 12345684
DIFU 11 10 04 06 08 HLXU1234574 12345685
Hope someone could help.
Thanks and Rgds/Des
-- My VB codes are --
Sub ConBody()
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Dim Wb1 As Workbook
Dim MovesType As String
Dim RowCounter As Integer
Set Ws1 = Worksheets(1)
Set Ws2 = Worksheets(2)
Set Wb1 = Workbooks("GateInOut_CON.xls")
Wb1.Activate
Ws1.Activate
RowCounter = 5 'row 5
Do While Cells(RowCounter, 1) <> ""
Ws2.Cells(RowCounter, 1) = (Cells(RowCounter, 1))
RowCounter = RowCounter + 1
Loop
End Sub
Bookmarks