PC Review


Reply
Thread Tools Rate Thread

Copy cell of one excel sheet to other

 
 
Mohan
Guest
Posts: n/a
 
      29th Jul 2007
Hi,
I have a folder that contains Excel files. The files are numbered a0
to a1000;b1 to b2000; c1 to c3000; d1 to d4000; e1 to e5000; and f1 to
f561(A total of 5562 Excel files). I need to copy the B column 11124
row (cell) in each file and paste it in a new Excel file in one column
in the same order.(I mean the a0 file B column 11124 row cell should
be pasted in A column 1 st row cell of a new excel file; a1 file B
column 11124 row cell to be pasted in A column 2nd row cell of a new
excel file and so on... for all the 5562 files).
I would be really thanlful if you could kindly let me know the
complete code with procedure to do it. Thanks in advance. Awaiting
code procedure at the earliest possible attention.
Thanks;
Mapa.

 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      29th Jul 2007
See your other thread

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mohan" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hi,
> I have a folder that contains Excel files. The files are numbered a0
> to a1000;b1 to b2000; c1 to c3000; d1 to d4000; e1 to e5000; and f1 to
> f561(A total of 5562 Excel files). I need to copy the B column 11124
> row (cell) in each file and paste it in a new Excel file in one column
> in the same order.(I mean the a0 file B column 11124 row cell should
> be pasted in A column 1 st row cell of a new excel file; a1 file B
> column 11124 row cell to be pasted in A column 2nd row cell of a new
> excel file and so on... for all the 5562 files).
> I would be really thanlful if you could kindly let me know the
> complete code with procedure to do it. Thanks in advance. Awaiting
> code procedure at the earliest possible attention.
> Thanks;
> Mapa.
>

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      29th Jul 2007
This is untested, but should do what you describe.
It assumes it processes all workbooks in a specific directory.
It assumes these have names like a0.xls and f561.xls

It assumes the value you want is on the first worksheet in those workbooks.

Sub copydata()
Dim sh As Worksheet
Dim sPath As String, fname As String
Dim rw As Long, s As String
Dim s1 As String
Dim bk As Workbook
Set sh = ActiveSheet
sh.Cells(1, 2).EntireColumn.Insert
sPath = "C:\Myfolder\"
fname = Dir(sPath & "*.xls")
rw = 0
Do While fname <> ""
s1 = Left(fname, 1) & Format(CLng(Mid(s, 2)), "00000")
Set bk = Workbooks.Open(sPath & fname)
rw = rw + 1
sh.Cells(rw, 1).Value = bk.Worksheets(1) _
.Range("B11124").Value
sh.Cells(rw, 2).Value = s1
bk.Close SaveChanges:=False
fname = Dir()
Loop
sh.Range("A1").CurrentRegion.Sort Key1:=sh.Range("B1"), _
order1:=xlAscending, Header:=xlNo
sh.Columns(2).Delete
End Sub

--
Regards,
Tom Ogilvy



"Mohan" wrote:

> Hi,
> I have a folder that contains Excel files. The files are numbered a0
> to a1000;b1 to b2000; c1 to c3000; d1 to d4000; e1 to e5000; and f1 to
> f561(A total of 5562 Excel files). I need to copy the B column 11124
> row (cell) in each file and paste it in a new Excel file in one column
> in the same order.(I mean the a0 file B column 11124 row cell should
> be pasted in A column 1 st row cell of a new excel file; a1 file B
> column 11124 row cell to be pasted in A column 2nd row cell of a new
> excel file and so on... for all the 5562 files).
> I would be really thanlful if you could kindly let me know the
> complete code with procedure to do it. Thanks in advance. Awaiting
> code procedure at the earliest possible attention.
> Thanks;
> Mapa.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Microsoft Excel Misc 2 15th May 2010 06:49 AM
Auto copy cell data from source sheet to another wrkbook sheet IVLUTA Microsoft Excel Programming 2 2nd Jun 2009 05:07 PM
Excel? How to copy sheet in workbook w/o having reconfirm cell nam Robert M Microsoft Excel Misc 2 17th May 2008 03:10 PM
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Microsoft Excel Programming 4 5th Oct 2007 04:00 PM
Excel Macro - copy cell contents to name a new sheet in another spreadsheet brandc@britax.com.au Microsoft Excel Misc 2 14th May 2004 12:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:17 AM.