PC Review


Reply
Thread Tools Rate Thread

Appending Contents Of Multiple Spreadsheets Into One

 
 
Sheldon Potolsky
Guest
Posts: n/a
 
      9th May 2008
Hello. I would like to open up a new spreadsheet and append rows 2 -
EOF from six other spreadsheets into that new one, be prompted for the
name to save it with, then save and quit. Would someone be kind
enough to offer some VBA code to do this with?
Thank you,
Sheldon Potolsky
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      9th May 2008
Set Sumsht = Worksheets.Add(after:=Sheets(Sheets.Count))
Sumsht.Name = "Summary"
For Each sht In ThisWorkbook.Sheets
If sht.Name <> Sumsht.Name Then
SumLastRow = Sumsht.Range("A" & Rows.Count).End(xlUp).Row
shtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("2:" & shtLastRow).Copy _
Destination:=Sumsht.Rows(SumLastRow + 1)
End If
Next sht

"Sheldon Potolsky" wrote:

> Hello. I would like to open up a new spreadsheet and append rows 2 -
> EOF from six other spreadsheets into that new one, be prompted for the
> name to save it with, then save and quit. Would someone be kind
> enough to offer some VBA code to do this with?
> Thank you,
> Sheldon Potolsky
>

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      9th May 2008
I forgot the SAVEAS

Set Sumsht = Worksheets.Add(after:=Sheets(Sheets.Count))
Sumsht.Name = "Summary"
For Each sht In ThisWorkbook.Sheets
If sht.Name <> Sumsht.Name Then
SumLastRow = Sumsht.Range("A" & Rows.Count).End(xlUp).Row
shtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("2:" & shtLastRow).Copy _
Destination:=Sumsht.Rows(SumLastRow + 1)
End If
Next sht

FName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName <> False Then
ThisWorkbook.SaveAs Filename:=FName
ThisWorkbook.Close
End If

"Sheldon Potolsky" wrote:

> Hello. I would like to open up a new spreadsheet and append rows 2 -
> EOF from six other spreadsheets into that new one, be prompted for the
> name to save it with, then save and quit. Would someone be kind
> enough to offer some VBA code to do this with?
> Thank you,
> Sheldon Potolsky
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      9th May 2008
See also
http://www.rondebruin.nl/copy3.htm

--

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


"Sheldon Potolsky" <(E-Mail Removed)> wrote in message news:eca5c476-6e00-4cdb-9d06-(E-Mail Removed)...
> Hello. I would like to open up a new spreadsheet and append rows 2 -
> EOF from six other spreadsheets into that new one, be prompted for the
> name to save it with, then save and quit. Would someone be kind
> enough to offer some VBA code to do this with?
> Thank you,
> Sheldon Potolsky

 
Reply With Quote
 
Sheldon Potolsky
Guest
Posts: n/a
 
      12th May 2008
Thank you Ron and Joel for the code to do this.
Sheldon

On May 9, 10:16*am, "Ron de Bruin" <rondebr...@kabelfoon.nl> wrote:
> See alsohttp://www.rondebruin.nl/copy3.htm
>
> --
>
> Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
>
>
>
> "Sheldon Potolsky" <SHPsalm...@aol.com> wrote in messagenews:eca5c476-6e00-4cdb-9d06-(E-Mail Removed)...
> > Hello. *I would like to open up a new spreadsheet and append rows 2 -
> > EOF from six other spreadsheets into that new one, be prompted for the
> > name to save it with, then save and quit. *Would someone be kind
> > enough to offer some VBA code to do this with?
> > Thank you,
> > Sheldon Potolsky- Hide quoted text -

>
> - Hide quoted text -


 
Reply With Quote
 
Sheldon Potolsky
Guest
Posts: n/a
 
      12th May 2008
Joel,
I tried running the code you sent and realized that I may not have
been clear on a couple of things.
I actually wanted to append rows 2-EOF from other spreadsheets (and be
prompted for them), and save them in Sheet1 sheet in the blank
spreadsheet I just opened. So, if in my C:\Excel folder I have
Sheldon1.xls, Sheldon2.xls, Sheldon3.xls and Joel1.xls, I would reply
to a prompt for which spreadsheets to include. My response would be
Sheldon*.xls. Rows 2-EOF for all three spreadsheets would be appended
to Sheet1 in my blank spreadsheet. After that your SAVEAS section of
the code would run, I'd select a filename and the new spreadsheet
would be saved and the program would complete.
Thanks, Sheldon

On May 9, 9:10*am, Joel <J...@discussions.microsoft.com> wrote:
> I forgot the SAVEAS
>
> Set Sumsht = Worksheets.Add(after:=Sheets(Sheets.Count))
> Sumsht.Name = "Summary"
> For Each sht In ThisWorkbook.Sheets
> * *If sht.Name <> Sumsht.Name Then
> * * * SumLastRow = Sumsht.Range("A" & Rows.Count).End(xlUp).Row
> * * * shtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
> * * * sht.Rows("2:" & shtLastRow).Copy _
> * * * * *Destination:=Sumsht.Rows(SumLastRow + 1)
> * *End If
> Next sht
>
> FName = Application.GetSaveAsFilename( _
> * * fileFilter:="Excel Files (*.xls), *.xls")
> If fileSaveName <> False Then
> * * ThisWorkbook.SaveAs Filename:=FName
> * * ThisWorkbook.Close
> End If
>
>
>
> "Sheldon Potolsky" wrote:
> > Hello. *I would like to open up a new spreadsheet and append rows 2 -
> > EOF from six other spreadsheets into that new one, be prompted for the
> > name to save it with, then save and quit. *Would someone be kind
> > enough to offer some VBA code to do this with?
> > Thank you,
> > Sheldon Potolsky- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
Sheldon Potolsky
Guest
Posts: n/a
 
      12th May 2008
Hi Ron. I tried your code (below) but got:
Compile error: Sub or Function not defined (with Get_File_Names
highlighted)
Am I missing something?
Thanks, Sheldon
*****************************
Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="C:\Users\Ron\test", _
Subfolders:=False, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="", _
SourceShIndex:=1, _
SourceRng:="A1:G1", _
StartCell:="", _
myReturnedFiles:=myFiles

End Sub

On May 9, 10:16*am, "Ron de Bruin" <rondebr...@kabelfoon.nl> wrote:
> See alsohttp://www.rondebruin.nl/copy3.htm
>
> --
>
> Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
>
>
>
> "Sheldon Potolsky" <SHPsalm...@aol.com> wrote in messagenews:eca5c476-6e00-4cdb-9d06-(E-Mail Removed)...
> > Hello. *I would like to open up a new spreadsheet and append rows 2 -
> > EOF from six other spreadsheets into that new one, be prompted for the
> > name to save it with, then save and quit. *Would someone be kind
> > enough to offer some VBA code to do this with?
> > Thank you,
> > Sheldon Potolsky- Hide quoted text -

>
> - Hide quoted text -


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      12th May 2008
You not copy all the code

Download the example workbook and test it

--

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


"Sheldon Potolsky" <(E-Mail Removed)> wrote in message news:00941541-b389-44df-8081-(E-Mail Removed)...
Hi Ron. I tried your code (below) but got:
Compile error: Sub or Function not defined (with Get_File_Names
highlighted)
Am I missing something?
Thanks, Sheldon
*****************************
Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="C:\Users\Ron\test", _
Subfolders:=False, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="", _
SourceShIndex:=1, _
SourceRng:="A1:G1", _
StartCell:="", _
myReturnedFiles:=myFiles

End Sub

On May 9, 10:16 am, "Ron de Bruin" <rondebr...@kabelfoon.nl> wrote:
> See alsohttp://www.rondebruin.nl/copy3.htm
>
> --
>
> Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
>
>
>
> "Sheldon Potolsky" <SHPsalm...@aol.com> wrote in messagenews:eca5c476-6e00-4cdb-9d06-(E-Mail Removed)...
> > Hello. I would like to open up a new spreadsheet and append rows 2 -
> > EOF from six other spreadsheets into that new one, be prompted for the
> > name to save it with, then save and quit. Would someone be kind
> > enough to offer some VBA code to do this with?
> > Thank you,
> > Sheldon Potolsky- Hide quoted text -

>
> - Hide quoted text -


 
Reply With Quote
 
ACarella
Guest
Posts: n/a
 
      26th Jun 2008
Hi Ron:
I was wondering if you could help me.

I have the following in Excel 2007:
w8001.xlsx
w346.xlsx
w78.xlsx
w172.xlsx

w8001.xlsx has 8 columns and 8001 rows of data
w346.xlsx has 3 columns and 346 rows of data
w78.xlsx has 3 columns and 78 rows of data
w172.xlsx has 3 columns and 172 rows of data

I need to append the three columns (A, B and C) of w346, 278 and w172 to the
END of W8001 and the data to append to the appropriate 3 columns.
How do I proceed.

"Ron de Bruin" wrote:

> You not copy all the code
>
> Download the example workbook and test it
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Sheldon Potolsky" <(E-Mail Removed)> wrote in message news:00941541-b389-44df-8081-(E-Mail Removed)...
> Hi Ron. I tried your code (below) but got:
> Compile error: Sub or Function not defined (with Get_File_Names
> highlighted)
> Am I missing something?
> Thanks, Sheldon
> *****************************
> Sub RDB_Merge_Data()
> Dim myFiles As Variant
> Dim myCountOfFiles As Long
>
> myCountOfFiles = Get_File_Names( _
> MyPath:="C:\Users\Ron\test", _
> Subfolders:=False, _
> ExtStr:="*.xl*", _
> myReturnedFiles:=myFiles)
>
> If myCountOfFiles = 0 Then
> MsgBox "No files that match the ExtStr in this folder"
> Exit Sub
> End If
>
> Get_Data _
> FileNameInA:=True, _
> PasteAsValues:=True, _
> SourceShName:="", _
> SourceShIndex:=1, _
> SourceRng:="A1:G1", _
> StartCell:="", _
> myReturnedFiles:=myFiles
>
> End Sub
>
> On May 9, 10:16 am, "Ron de Bruin" <rondebr...@kabelfoon.nl> wrote:
> > See alsohttp://www.rondebruin.nl/copy3.htm
> >
> > --
> >
> > Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
> >
> >
> >
> > "Sheldon Potolsky" <SHPsalm...@aol.com> wrote in messagenews:eca5c476-6e00-4cdb-9d06-(E-Mail Removed)...
> > > Hello. I would like to open up a new spreadsheet and append rows 2 -
> > > EOF from six other spreadsheets into that new one, be prompted for the
> > > name to save it with, then save and quit. Would someone be kind
> > > enough to offer some VBA code to do this with?
> > > Thank you,
> > > Sheldon Potolsky- Hide quoted text -

> >
> > - Hide quoted text -

>
>

 
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
in spreadsheets copying cell contents plus font colour NDBC Microsoft Excel Misc 1 6th Jul 2009 06:43 AM
Appending contents of clipboard to a selected cell range Poster Microsoft Excel Programming 2 1st Feb 2007 02:50 AM
Appending contents of a list box to a database =?Utf-8?B?T2x1IFNvbGFydQ==?= Microsoft Access Form Coding 0 18th Aug 2006 03:37 PM
Comparing contents of two spreadsheets and outputting results to a =?Utf-8?B?YnJ4?= Microsoft Excel Worksheet Functions 5 17th Mar 2005 01:44 AM
Appending spreadsheets =?Utf-8?B?RGVyZWsgV2l0dG1hbg==?= Microsoft Excel Misc 1 11th Nov 2003 04:01 PM


Features
 

Advertising
 

Newsgroups
 


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