Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Mass File Column Insert and Name

I need to create a procedure that will loop through all files in a specified
path, insert a new column in each file called FileName, then write the actual
file name for that file into the column all the way down the list.

How can I accomplish this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Mass File Column Insert and Name


Sub addcolumns()

Const MyPath = "c:\temp"


First = True
Do
If First = True Then
Filename = Dir(MyPath & "\*.xls")
First = False
Else
Filename = Dir()
End If

If Filename < "" Then
Workbooks.Open (MyPath & "\" & Filename)
Range("B1").EntireColumn.Insert

Range("B1:B100").Value = Filename


End If
Workbooks(Filename).Close
Loop While Filename < ""

End Sub

"Kirk P." wrote:

I need to create a procedure that will loop through all files in a specified
path, insert a new column in each file called FileName, then write the actual
file name for that file into the column all the way down the list.

How can I accomplish this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't insert column in Excell file! Help please Olga Excel Worksheet Functions 2 September 13th 08 01:53 AM
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
Mass add in a column 49erfan Excel Discussion (Misc queries) 4 October 24th 07 05:45 PM
I want to do mass mailing in outlook, from an excel file that has. Franco Excel Discussion (Misc queries) 2 January 25th 05 07:49 AM


All times are GMT +1. The time now is 10:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"