MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 20th, 2002, 01:55 AM   #1
warhorse927
 
Join Date: May 2002
Location: Mike Warren
Posts: 30
Default

I need some ideas. I created a little grade sheet for myself and the other teachers liked it. Now, the admin. wants all the "gradesheets" consolidated for statical analysis. all internal would not be to hard but many will have to come in from email. All gradesheets (workbooks acutally) are identical in form but obviously have different data in them. Besides copy and paste, is there an way to append the data from each emailed spreadsheet (roughly 30) to a "master sheet" and is this even the best way? I need to stay out of access for this. HELP!
warhorse927 is offline   Reply With Quote
Old May 20th, 2002, 04:54 AM   #2
Tom Schreiner
 
Join Date: Mar 2002
Posts: 6,680
Default

Hi there...
Just to let you know that it is easily possible.
I am unsure as to the best way???
There are likely several good ways to go about this. If you want to go the VBA route, which may or may not be the best way, I can help you out.
You would need to list the specifics such as sheet names, cell ranges, how the data will be manipulated... We try to keep all replies on the board and avoid emailing solutions to keep the solution accessible to others with similiar goals. However, it might be easier, in this case, to email a sample workbook with a description of the outcome in the master workbook. I would be willing to take a look and then post a summary of my solution. Others then might want to improve upon or suggest better alternatives.
Click on the mail icon below if you wish.
Please zip the file(s) up. 28k connection here.
Tom
Tom Schreiner is offline   Reply With Quote
Old May 22nd, 2002, 08:02 AM   #3
Tom Schreiner
 
Join Date: Mar 2002
Posts: 6,680
Default

Hi Mike.
This will solve the problem stated in your initial post to Mr Excel. I will post the macro in case it might help others as well. Create or choose an existing folder which will house all of your inboxed workbooks. Place this attached file in the same folder as this is the path which will be searched for the source data. The code associated with your commandbutton(UpDate) will step through and open each Excel file in this folder and take the Range A3:AH3 on worksheet "Data" and place the info on the next available line in your Master workbook in Columns B to AH.
There is no error handling. You must also remove the files already processed to avoid duplication and, therefore, incorrect results when you manipulate your collected data.
I am unsure as to your experience with VBA. If the code needs to be commented, let me know. If you need to make changes, post and someone will, doubtless, be able to help you out. You may want to monitor this thread for other suggestions as well. As far as your concern about the workbook becoming too saturated, it seems Excel will be fine for this project indefinitely.

Thanks to Mudface for the assistance with the Workbook.Open method.

A link to your Mr Excel post: http://www.mrexcel.com/board/viewtop...8809&forum=2&1

Hope this helps,
Tom



Private Sub cmdUpdate_Click()
Dim FS, i
Dim PlaceRow As Long
Dim OpenedName As String
Dim DoNotReopenActiveWB_Name As String
Dim MasterWorkBook As String

Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False

DoNotReopenActiveWB_Name = ActiveWorkbook.FullName
MasterWorkBook = ActiveWorkbook.Name
PlaceRow = Sheets("MasterSheet").Range("c1:c" & Range("c65536").End(xlUp).Row).Rows.Count
If PlaceRow < 3 Then PlaceRow = 3
Set FS = Application.FileSearch
With FS
.LookIn = ActiveWorkbook.Path
.Filename = "*.xls"
If .Execute Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) <> DoNotReopenActiveWB_Name Then
PlaceRow = PlaceRow + 1
Workbooks.Open .FoundFiles(i), 0
OpenedName = ActiveWorkbook.Name
Workbooks(MasterWorkBook).Sheets("MasterSheet") _
.Range("B" & PlaceRow & ":AH" & PlaceRow).Value = _
Workbooks(OpenedName).Sheets("Data") _
.Range("A3:AG3").Value
Workbooks(OpenedName).Close savechanges:=False
End If
Next i
End If
End With

Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub



[ This Message was edited by: TsTom on 2002-05-22 03:06 ]
Tom Schreiner is offline   Reply With Quote
Old May 22nd, 2002, 12:24 PM   #4
warhorse927
 
Join Date: May 2002
Location: Mike Warren
Posts: 30
Default

Thanks Tom. I think this will do exactly what I want for now. One question: Is it possible to use range names instead of cell ranges? OK two questions, If every imported workbook had that row named the same?
warhorse927 is offline   Reply With Quote
Old May 23rd, 2002, 05:39 AM   #5
Tom Schreiner
 
Join Date: Mar 2002
Posts: 6,680
Default

Sure.
Replace the current line"


Workbooks(OpenedName).Sheets("Data") _
.Range("A3:AG3").Value


with

Workbooks(OpenedName).Sheets("Data") _
.Range("SendRange").Value


...where "SendRange" would be the name of the range.

Tom
Tom Schreiner is offline   Reply With Quote
Old Aug 17th, 2005, 04:16 PM   #6
aeroballer
 
Join Date: Jul 2005
Posts: 21
Default

I tried this code and got a subscript out of range error at this line:
PlaceRow = Sheets("MasterSheet").Range("c1:c" & Range("c100").End(xlUp).row).Rows.Count

I just wanted to see if the code worked, but am unable to get it to work.

What I would like to do is have a master workbook that contains data from 50 source workbooks. I need this macro to add all of the workbooks in a folder and pull the data from A3:S6, and place it in the master workbook, one after the other.
Example: Master Workbook
1----
2----
3 Source 1 A3.....
4 Source 1 A4....
................
6 Source 1 A6....
7 Source 2 A3...
8 Source 2 A4.....
aeroballer is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT +1. The time now is 05:09 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes