Results 1 to 6 of 6

Remove space from text output

Threaded View

  1. #1
    Registered User
    Join Date
    11-09-2006
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    200

    Remove space from text output

    Hi,
    I have this small macro which saves results of two columns in excel to a text file - each 5 seconds. It separates the columns with the space- but for some reason it adds the space BEFORE 1st column. I wonder if it can be changed to remove the first SPACE:

    Sub TEST()
        Dim c As Range, r As Range
        Dim output As String
        Calculate
        For Each r In Range("A1:B20").Rows
            For Each c In r.Cells
                output = output & " " & c.Value
            Next c
            output = output & vbNewLine
        Next r
        Open "C:\DATA\signals.txt" For Output As #1
        Print #1, output
        Close
    End Sub
    Thanks a lot!
    Last edited by zealot; 10-06-2019 at 03:39 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Modify macro if found empty cell to do nothing and expand the range of macro
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-15-2018, 03:44 AM
  2. Modify macro to only look at three ws not all
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2015, 07:06 PM
  3. Replies: 2
    Last Post: 11-03-2014, 12:06 PM
  4. Macro Help - Modify macro to save as to specific location
    By scoochUM in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-30-2014, 04:10 PM
  5. Help to modify a macro
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2013, 05:27 AM
  6. Stop Macro, Check Cells & Modify if Necessary, Resume Macro
    By AccountantCost in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2009, 07:39 AM
  7. Replies: 3
    Last Post: 08-11-2008, 09:21 AM

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