Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default copy many files into one

Hi,

I want to copy the usedranges from many files into one excel file. I
want those usedranges to be appended to the last column and not to the
last row. I thought that this part would do it, but it doesn't

Destination:=TargetSht.Cells(1, Columns.Count).End(xlLeft).Offset(0,
1)

Can anyone help please ?
Thank you
Gabriel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default copy many files into one

Hi Gabriel

See this page for a example
http://www.rondebruin.nl/copy3.htm#column

Note: you only have 256 columns



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gabriel" wrote in message om...
Hi,

I want to copy the usedranges from many files into one excel file. I
want those usedranges to be appended to the last column and not to the
last row. I thought that this part would do it, but it doesn't

Destination:=TargetSht.Cells(1, Columns.Count).End(xlLeft).Offset(0,
1)

Can anyone help please ?
Thank you
Gabriel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default copy many files into one

You can also use a function to find the last column with data
Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End FunctionSub test()
MsgBox Lastcol(ActiveSheet)
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi Gabriel

See this page for a example
http://www.rondebruin.nl/copy3.htm#column

Note: you only have 256 columns



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gabriel" wrote in message om...
Hi,

I want to copy the usedranges from many files into one excel file. I
want those usedranges to be appended to the last column and not to the
last row. I thought that this part would do it, but it doesn't

Destination:=TargetSht.Cells(1, Columns.Count).End(xlLeft).Offset(0,
1)

Can anyone help please ?
Thank you
Gabriel





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default copy many files into one

This is a mess<g

Try this

You can also use a function to find the last column with data

Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End Function

Sub test()
MsgBox Lastcol(ActiveSheet)
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
You can also use a function to find the last column with data
Function Lastcol(sh As Worksheet)
On Error Resume Next
Lastcol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End FunctionSub test()
MsgBox Lastcol(ActiveSheet)
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi Gabriel

See this page for a example
http://www.rondebruin.nl/copy3.htm#column

Note: you only have 256 columns



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gabriel" wrote in message om...
Hi,

I want to copy the usedranges from many files into one excel file. I
want those usedranges to be appended to the last column and not to the
last row. I thought that this part would do it, but it doesn't

Destination:=TargetSht.Cells(1, Columns.Count).End(xlLeft).Offset(0,
1)

Can anyone help please ?
Thank you
Gabriel







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
Copy and Paste Between Files Dragon Excel Discussion (Misc queries) 1 February 5th 07 04:26 AM
copy files Young-Hwan Choi Excel Programming 1 June 14th 04 03:06 AM
Copy Files desmondleow[_16_] Excel Programming 5 April 21st 04 08:11 PM
Copy values between files. Ron[_20_] Excel Programming 0 March 4th 04 12:03 AM
copy files from one dir to another rvik[_14_] Excel Programming 7 February 13th 04 01:30 PM


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

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

About Us

"It's about Microsoft Excel"