+ Reply to Thread
Results 1 to 2 of 2

Simple Macro to Export Each Cell as Separate Files

Hybrid View

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    Paris
    MS-Off Ver
    Excel 2011
    Posts
    2

    Simple Macro to Export Each Cell as Separate Files

    Hey guys.

    Here's the structure of my file :

    A_____ B_____
    Name1 Content1
    Name2 Content2

    I would like to create a file for each row, called "Name1.html" and with content "Content1". Nothing too complicated but I have too many to do it one by one.

    Here's what I tried. It gives me no result, like nothing happened. Could you tell me what's wrong ?
    Sub CreateTxtFiles()
    Dim rng As Range
    Dim ff As Long
    Dim LastRow As Long
    Dim I As Long
        LastRow = Range("B" & Rows.Count).End(xlUp).Row
        
        For I = 1 To LastRow
            Set rng = Range("B" & I)
            ff = FreeFile()
            
            Open "Macintosh HD:Users:Moop:Desktop" & rng.Address(0, 0) & ".html" For Output As #ff
                Print #ff, rng.Value
            Close #ff
            
        Next I
        
    End Sub
    Thanks

  2. #2
    Registered User
    Join Date
    12-16-2013
    Location
    Paris
    MS-Off Ver
    Excel 2011
    Posts
    2

    Re: Simple Macro to Export Each Cell as Separate Files

    My bad, worked fine

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Simple CSV Export Macro Help!
    By somebody113 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2012, 03:08 PM
  2. Customized macro to export cells to txt files?
    By Handyy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2010, 09:27 AM
  3. Replies: 0
    Last Post: 11-09-2009, 09:57 AM
  4. split it into groups of 100 and export it to separate .csvs or text files
    By Shaunclippo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2006, 01:40 PM
  5. Simple macro needed to export a worksheet
    By RobG in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-12-2005, 05:12 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