Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default copying using a macro

I have a big problem, and I need some help;
I have for about 2000 excel files in my computer, that contain each one
about 10 sheets inside. In one of the sheets I have a map, and I need to copy
some ranges (columns) to another workbook, using a macro.
The problem is that in each excel file (2000 different one), the range that
I want to copy has different sizes. I dont know how to make a formula that
say that the range is to be for example between A1 and an empty line.

workbook 1 workbook 2 new workbook
A A A
1 100ぎ 50ぎ
2 200ぎ 30ぎ
3 300ぎ
4

First time I need to copy the cells from A1 to A3 to the new workbook.
In a second time, after deleted the values in the new workbook, and using
the macro, it must copy de cells of the workbook from A1 to A2 again to the
new workbook.
So how can I say that in the first case the range stops at A3 and in the
second case it stops at A2?


Thanks for the help.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default copying using a macro

Don,

Thanks for the help... but I still need your support.

Here is my macro:

彜ub Macro3()
'
' Macro3 Macro
' Macro recorded 27-06-2008 by PEDRO DAVID MARTINS PEDROSA COSTA
'

'
Workbooks.Open Filename:="G:\BII\DCC\0_MaPAExpurgo.xls"
Range("A2:AA859").Select
Application.CutCopyMode = False
Selection.ClearContents
Windows("exp upi.xls").Activate
Range("H15:H17").Select
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("P2").Select
ActiveSheet.Paste
Windows("exp upi.xls").Activate
Range("D15:D17").Select
Application.CutCopyMode = False
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("H2").Select
ActiveSheet.Paste
Range("D6:W6").Select
Windows("exp upi.xls").Activate
Range("R15:R17").Select
Application.CutCopyMode = False
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("R2").Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

What I really need is to create 徭omething in the macro that says:
彝ange("H15:掎ntil an empty line").Select, instead of:
彝ange("H15:H17").Select
彝ange("D15:掎ntil an empty line").Select, instead of:
彝ange("D15:D17").Select
彝ange("R15:掎ntil an empty line").Select, instead of:
彝ange("R15:R17").Select

Thanks

Pedro

"Don Guillett" escreveu:

this is the idea
for each wb
with workbook("dest.xls").sheets("sheet1")
destinationlastrow=.cells(rows.count,"a").end(xlup ).row +1
sourcelastrow=wb.cells(rows.count,"a").end(xlup).r ow
wb.range(cells(2,"a"),cells(sourcelastrow,"a")).co py _
.cells(destinationlastrow,"a")
end with
next wb
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"divad" wrote in message
...
I have a big problem, and I need some help;
I have for about 2000 excel files in my computer, that contain each one
about 10 sheets inside. In one of the sheets I have a map, and I need to
copy
some ranges (columns) to another workbook, using a macro.
The problem is that in each excel file (2000 different one), the range
that
I want to copy has different sizes. I dont know how to make a formula
that
say that the range is to be for example between A1 and an empty line.

workbook 1 workbook 2 new workbook
A A A
1 100ぎ 50ぎ
2 200ぎ 30ぎ
3 300ぎ
4

First time I need to copy the cells from A1 to A3 to the new workbook.
In a second time, after deleted the values in the new workbook, and using
the macro, it must copy de cells of the workbook from A1 to A2 again to
the
new workbook.
So how can I say that in the first case the range stops at A3 and in the
second case it stops at A2?


Thanks for the help.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default copying using a macro

In which workbook do you want the macro to reside, source(exp upi.xls)or
destination.(0_MaPAExpurgo.xls)
Apparently you did not bother to try to implement my provided macro which
does NOT select. You really should try offered free solutions or contact me
privately for custom work.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"divad" wrote in message
...
Don,

Thanks for the help... but I still need your support.

Here is my macro:

彜ub Macro3()
'
' Macro3 Macro
' Macro recorded 27-06-2008 by PEDRO DAVID MARTINS PEDROSA COSTA
'

'
Workbooks.Open Filename:="G:\BII\DCC\0_MaPAExpurgo.xls"
Range("A2:AA859").Select
Application.CutCopyMode = False
Selection.ClearContents
Windows("exp upi.xls").Activate
Range("H15:H17").Select
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("P2").Select
ActiveSheet.Paste
Windows("exp upi.xls").Activate
Range("D15:D17").Select
Application.CutCopyMode = False
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("H2").Select
ActiveSheet.Paste
Range("D6:W6").Select
Windows("exp upi.xls").Activate
Range("R15:R17").Select
Application.CutCopyMode = False
Selection.Copy
Windows("0_MaPAExpurgo.xls").Activate
Range("R2").Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub

What I really need is to create 徭omething in the macro that says:
彝ange("H15:掎ntil an empty line").Select, instead of:
彝ange("H15:H17").Select
彝ange("D15:掎ntil an empty line").Select, instead of:
彝ange("D15:D17").Select
彝ange("R15:掎ntil an empty line").Select, instead of:
彝ange("R15:R17").Select

Thanks

Pedro

"Don Guillett" escreveu:

this is the idea
for each wb
with workbook("dest.xls").sheets("sheet1")
destinationlastrow=.cells(rows.count,"a").end(xlup ).row +1
sourcelastrow=wb.cells(rows.count,"a").end(xlup).r ow
wb.range(cells(2,"a"),cells(sourcelastrow,"a")).co py _
.cells(destinationlastrow,"a")
end with
next wb
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"divad" wrote in message
...
I have a big problem, and I need some help;
I have for about 2000 excel files in my computer, that contain each one
about 10 sheets inside. In one of the sheets I have a map, and I need
to
copy
some ranges (columns) to another workbook, using a macro.
The problem is that in each excel file (2000 different one), the range
that
I want to copy has different sizes. I dont know how to make a formula
that
say that the range is to be for example between A1 and an empty line.

workbook 1 workbook 2 new workbook
A A A
1 100ぎ 50ぎ
2 200ぎ 30ぎ
3 300ぎ
4

First time I need to copy the cells from A1 to A3 to the new workbook.
In a second time, after deleted the values in the new workbook, and
using
the macro, it must copy de cells of the workbook from A1 to A2 again to
the
new workbook.
So how can I say that in the first case the range stops at A3 and in
the
second case it stops at A2?


Thanks for the help.





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
Copying a Macro Keepsmiling1228 Excel Discussion (Misc queries) 1 March 31st 08 05:31 PM
Macro for Copying Frank Situmorang[_2_] Excel Worksheet Functions 9 January 29th 08 08:04 AM
copying with a Macro DonT Excel Worksheet Functions 2 March 24th 06 07:45 PM
Copying with a macro DonT Excel Worksheet Functions 2 March 23rd 06 03:04 AM
Copying with a macro Markxxx Excel Discussion (Misc queries) 1 January 13th 05 09:56 AM


All times are GMT +1. The time now is 12:37 PM.

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"