+ Reply to Thread
Results 1 to 3 of 3

Cell reference cell then append specific text using vb

Hybrid View

  1. #1
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Cell reference cell then append specific text using vb

    This is probably really easy but I don't know what I'm doing wrong.

    Sub Backflip()
        Range("A375").Select
        Range(Selection, Selection.End(xlDown)).Select
        ExportToTextFile FName:="C:\Users\admin\Desktop\xyz.txt", Sep:="'", _
           SelectionOnly:=True, AppendData:=False
    End Sub
    Pretend I have "C:\Users\admin\Desktop\" in cell D1 and I want to manually keep xyz.txt the same always but just append it to the file path in cell D1 within the vb code. I want to concatenate the D1 value along with a value that I will manually write out in the vb code.

    I'm trying

    ExportToTextFile FName:="$D$1" & "xyz.txt",

    but I'm not sure how to say select D1.

    I apologize if this is so basic.

    Thanks
    Last edited by sweetrevelation; 05-17-2009 at 12:44 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Cell reference cell then append specific text using vb

    Hello sweetrevelation,

    The VBA code would be...
      ExportToTextFile FName:=Range("$D$1") & "xyz.txt"
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Cell reference cell then append specific text using vb

    Thank you Leith. I appreciate your help greatly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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