Results 1 to 2 of 2

Loop/Concatenate/SaveAs text ?

Threaded View

  1. #1
    Registered User
    Join Date
    10-19-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    1

    Question Loop/Concatenate/SaveAs text ?

    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
    Attached Files Attached Files
    Last edited by d_cww; 10-19-2011 at 04:44 AM. Reason: Inserted Tag for the VB codes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1