[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

VBA

Asked by generali in Microsoft Excel Spreadsheet Software

Tags: excel, vba, rows


I am in the middle of a long winded process of automating a daily letter print job. I do not have access to VB so I am trying to do everything in VBA;

The process in brief;
x amount of files are produced and placed in a particular folder, each file that is letter releted needs ro be opened in excel, indexed, sorted, formatted and then saved an closed. Each relative document in MS Word is opened, merged with the file and then printed to specific printers. The filenames of the datafiles change everyday.

What I want to do;
Obviously I want to automate the whole process but at the same time I am designing it aimed at people that are not very computer literate so it needs to visually easy to understand and process. I want to also copy all the data from the datafiles into worksheets, so I will be merging the MS Word documents with these instead, this cuts Word having to re-locate the files everyday.

What I have so far;
I have written some code that checks and displays all the available files in the folder, then it opens all the letter files I require into excel, visualy everything is all set up with userforms etc all ready to be coded. What I need to do no is copy all the data in these datafiles into the relevent worksheets, my problem is that I only need to copy rows and columns that have data in, this is to stop MS Word showing blank records.
   Each specific file has a 3 code identifier at the beggining of the filename, I use this to identify which letter is which, the files that I want and that are available are stored in associated cells within my main worksheet, each letter type now has a variable name for its datafile in VBA, my idea is to have another variable counting the number of rows and columns in each datafile, then use this in my copy code to select only the data I want rather than the whole file.
  This works fine if I use descriptive references rather than variables, e.g
---------------------------------
 Dim dt407 As Variant
    Dim letter As String
    Dim both As String
    Dim Test1 As Integer
   
   
    dt407 = Sheets("info1").Range("E5")
    both = Sheets("Dat1").Range("G25")
    letter = "A1:" & Sheets("Dat1").Range("F25") & "1"
   
    If Sheets("Info1").Range("K5") = "Not Present" Then
            Else: Sheets("407").Range("A1").Formula = "='" & dt407 & "'!A1"
                       Sheets("407").Select
                       
                       
                        Selection.AutoFill Destination:=Range(letter), Type:=xlFillDefault
                        Range(letter).Select
                        Selection.AutoFill Destination:=Range("A1:" & "Both"), Type:=xlFillDefault
==========================================

Without explaining the code too much (Theres alot of cell references I know !) my problem is that I cant count the number of rows and columns of a file that is open by using a static formula and/or code (By static I mean one that I do not have to change everyday and that it uses the variable to alter what file the code/formula should be looking at) Please can someone help me, either modifying the way I am trying to do it or equally a totally different way! Whichever!

Thankyou
 


[+][-]05/18/05 08:27 AM, ID: 14027980Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: excel, vba, rows
Sign Up Now!
Solution Provided By: leonstryker
Participating Experts: 1
Solution Grade: B
 
[+][-]05/18/05 07:55 AM, ID: 14027668Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/18/05 08:03 AM, ID: 14027747Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/18/05 08:06 AM, ID: 14027775Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/18/05 08:15 AM, ID: 14027880Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 01:47 AM, ID: 14034416Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 06:39 AM, ID: 14036147Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/26/05 05:24 AM, ID: 14085182Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92