LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Flling an array

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
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
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


All times are GMT +1. The time now is 09:45 AM.

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"