Link to home
Start Free TrialLog in
Avatar of finnstone
finnstone

asked on

INSERT value into first row in 75 workbooks

i need to put this value "PERSONURL" WITHOUT THE QUOTES, into line 1 of 75 folders in a windows folder - all the files are csv
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi Finn,

Will this be in just First Column & First Row or all the columns in First Row?
Avatar of finnstone
finnstone

ASKER

just cell A1
Will that replace the value that is in "A1" currently, or insert a row or column?


»bp
It would also be useful if you could provide a sample of the data files for testing...


»bp
ASKER CERTIFIED SOLUTION
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thx
Try this
Option Explicit

Public Sub UpdateCSV()

    Dim fso, sFolder, sFil
    On Error GoTo exit_proc
    Application.ScreenUpdating = False
    Set fso = CreateObject("Scripting.FileSystemObject")

    ''///Change this folder to the one you use.
    Set sFolder = fso.getFolder("C:\Users\Roy Cox\Documents\csvfiles")

    For Each sFil In sFolder.Files
        If (sFil.Name Like "*.csv") Then
            Workbooks.OpenText Filename:=sFil, _
                               DataType:=xlDelimited, Comma:=True, Local:=True
            Range("A1").Value = "X"
            sFil.Close True
        End If
    Next sFil
exit_proc:
    Application.ScreenUpdating = True
End Sub

Open in new window