Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You are welcome
-- Regards Ron de Bruin http://www.rondebruin.nl "Adri" wrote in message ... Ron, perfect I used Left(naam, Len(naam) - 4) and that didn't work. Now I know why. Thank you, learned a lot today. Kind regards, Adri Ron de Bruin wrote: | Try this | | ActiveSheet.Name = Left(mybook.Name, Len(mybook.Name) - 4) | | | | "Adri" wrote in message | ... || Ron, thank you very much || TestFile6() wil do the job for me. || Lats little request. How can the sheetnames get a name without .xls || Adri || || || Ron de Bruin wrote: ||| Hi Adri ||| ||| Look at this examples first ||| http://www.rondebruin.nl/copy3.htm ||| ||| ||| ||| "Adri" wrote in message ||| ... |||| Ron de Bruin wrote: ||||| Hi Adri ||||| ||||| You can select the files you want with the CTRL key down ||||| If you use CTRL-A in the dialog you select all the files ||||| ||||| Fname is the Array of the selected files ||||| ||||| You can loop through the files in the Array with this ||||| For N = LBound(FName) To UBound(FName) ||||| ||||| I use open the files as a example but you can do what you want. ||||| ||||| What do you want to do with the files in the Array? ||||| Maybe we can give you a better answer then ||||| |||| Hi Ron, |||| I have this code (from the internet). It copies the contence of the |||| seprate files to one workbook . |||| To prevent a lot of typing (the file are at a network server with |||| long names) I want to use the macro to fill the array. |||| I hope you understand the problem now. |||| |||| |||| Option Explicit |||| Sub GetData() |||| |||| Dim myWorkbooks As Variant |||| Dim myFolder As String |||| Dim testStr As String |||| Dim newWkbk As Workbook |||| Dim tempWkbk As Workbook |||| Dim wCtr As Long |||| |||| myFolder = "D:\Temp" |||| If Right(myFolder, 1) < "\" Then |||| myFolder = myFolder & "\" |||| End If |||| |||| Set newWkbk = Workbooks.Add(1) |||| ActiveSheet.Name = "DummyToDelete" |||| |||| myWorkbooks = Array("file1.xls", "file2.xls", "file4.xls") |||| |||| For wCtr = LBound(myWorkbooks) To UBound(myWorkbooks) |||| testStr = "" |||| On Error Resume Next |||| testStr = Dir(myFolder & myWorkbooks(wCtr)) |||| On Error GoTo 0 |||| If testStr = "" Then |||| MsgBox myWorkbooks(wCtr) & " Is missing!" & vbLf & _ |||| "Processing stopped" |||| Exit Sub |||| End If |||| |||| Set tempWkbk = Workbooks.Open(Filename:=myFolder & |||| myWorkbooks(wCtr), _ |||| ReadOnly:=True) |||| |||| tempWkbk.Worksheets(1).Copy _ |||| after:=newWkbk.Worksheets(newWkbk.Worksheets.Count ) |||| |||| tempWkbk.Close savechanges:=False |||| |||| Next wCtr |||| |||| Application.DisplayAlerts = False |||| newWkbk.Worksheets("DummyToDelete").Delete |||| Application.DisplayAlerts = True |||| |||| Call RenSheets |||| End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Complex conditional summing - array COUNT works, array SUM gives#VALUE | Excel Worksheet Functions | |||
Array formula: how to join 2 ranges together to form one array? | Excel Worksheet Functions | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
variant array containing cel adresses convert to actual ranges-array | Excel Programming |