Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In one part, I see I didn't get eveything changed when I copied a line of
code for i = 1 to ubound(vDat,1) Step 5 ii = 1 for j = i to i + 4 Name s1 & vDat(j,1) As s1 & ii & ".dat" Name s2 & vDat(j,2) As s2 & ii & ".dat" ii = ii + 1 Next j should have had a .dat and a .txt for i = 1 to ubound(vDat,1) Step 5 ii = 1 for j = i to i + 4 Name s1 & vDat(j,1) As s1 & ii & ".dat" Name s2 & vDat(j,2) As s2 & ii & ".txt" ii = ii + 1 Next j I am not sure I follow all you are saying, but if you ran the first code I gave you and changed all the file names to names like 1.dat and 1.txt, then that could cause some duplicate filenames when combined with this code. I saw this as handling the renaming. However, if you need to do the renumbering first I would suggest you modify that original code to name the files starting with an s1 & "A" & i & ".dat" as an example. dkin also offers a workable approach for sorting the file names although I suspect it is written for xl2007 and won't work (unchanged) in earlier versions. It also doesn't implement 5 at a time or explicitly address the 2nd set of files. So you would still need to tie it all together. -- Regards, Tom Ogilvy wrote in message ups.com... Tom, Thanks for your help Now that it only deletes the 10 files (5 txt and 5 dat) I can keep all of the files in those two folders with out transfering. All of these files are on a server at work so I can get them droped into those files instead. The problem I am having know is the renaming. You answered on of my first posts about remaming unknow files and the macro renames the files 1-5000 (whatever amount I have in the folder) here is the problem...... The first time I put in the files it works then I delete the 5 files I have already used and when I go back to rename them the second time it doesn't necessarily rename them 1-5 it may go 1,4,6,8,9,23. It seems to be random which means that when my macro searches for dat and txt files 1-5 it won't find them. I am so close to perfecting this thing but at the same time I can't see the light at the end of the tunnel. Thanks for all your help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|