Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 2nd, 2012, 06:13 PM
Authorized User
Points: 84, Level: 1
Points: 84, Level: 1 Points: 84, Level: 1 Points: 84, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2011
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default Reading in 29 Text files Each Month

My Excel 2010 question is two-fold. First I have 29 static tables that are generated each month. I have figured out how create individual macros (each table is a little different from the next) for each table to format it into a nice looking Excel sheet. The first part of my question is: Is there a way to combine all the Macros to run one after the other creating a new sheet for each of the imported tables and 2nd: Is there a way to prompt for month and year and use that dynamically within the macros for the change in month for processing? My file names look like TAY0112.rpt, TBY0112, TCY0112.rpt, TDM0112.rpt, TDY0112.rpt, etc. Any help on this would be greatly appreciated.
Old May 2nd, 2012, 08:30 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts


You need to use the combination of following

1. Dir function- to loop through directory and search files

2. Worksheets.Add After:=ActiveSheet

to create a new sheet

3. Application.InputBox or a Userform with Date Control to select the date

C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 29, Listing 29-7, Page 1305 kiwibrit BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 September 11th, 2009 05:53 AM
Reading text files senthilreddy ASP.NET 2.0 Basics 1 May 22nd, 2007 08:32 AM
query Current Month, Month+1, Month+2, Month+3 anterior Access 2 September 24th, 2006 08:25 PM
Reading excel and text files using VB6... CJ35 VB How-To 5 October 8th, 2004 03:56 AM
Regarding " reading text files" spraveens Classic ASP Basics 1 October 14th, 2003 07:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.