Advertisement

03.14.2008 at 08:29PM PDT, ID: 23243621
[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!

9.9

VBA Date Loop.   Scripting a loop that will execute each day between predefined Start/End Date

Asked by maverickcapital in Microsoft Excel Spreadsheet Software, Microsoft Visual Basic.Net, Spreadsheet Software

Tags:

Thanks in advance....to anyone who provides assitance
New to VBA and I'm having issues scripting a procedure that will copy the same cells for each individual day between a predefined start date/end date.  I attempted to build in small steps and have successfully completed a small procedure which I posted.
So on a basic level, if you had the following spreadsheat
Item       DailyCost       StartDate        EndDate
1            250               2/2/2008          3/2/2008
2            750              2/23/2008         3/14/2008

It would write to another sheet (called "DB") and the with the following results

Item      Cost      Date
1           250       2/2/2008
1           250       2/3/2008
1           250       2/4/2008
1           250       2/5/2008
1           250       2/6/2008
1           250       2/7/2008
etc.....
2          750       2/23/2008
2          750       2/24/2008
2          750       2/25/2008
2          750       2/26/2008

This task seems senseless, but I will eventually add additional functions to the "DB" sheet to generate reports, showing daily credits/debits.    I have attached the file and code that I currently have completed.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
Sub DBWriter()
 
Application.ScreenUpdating = False
 
Dim ID
Dim Status
Dim CreditDebut
Dim Broker
Dim Symbol
Dim Qty
Dim FeeBps
 
 
Sheets("Main").Activate
Range("A2").Select
 
Do
    If ActiveCell.Offset(0, 1).Value = "Active" Then
        
        ID = ActiveCell.Value
        Status = ActiveCell.Offset(0, 1)
        CreditDebit = ActiveCell.Offset(0, 2)
        Broker = ActiveCell.Offset(0, 3)
        Symbol = ActiveCell.Offset(0, 4)
        Qty = ActiveCell.Offset(0, 5)
        FeeBps = ActiveCell.Offset(0, 6)
        
        Sheets("DB").Activate
        Range("A1").End(xlDown).Offset(1, 0).Select
        ActiveCell.Value = ID
        ActiveCell.Offset(0, 1) = CreditDebit
        ActiveCell.Offset(0, 2) = CreditDebit
        ActiveCell.Offset(0, 3) = Broker
        ActiveCell.Offset(0, 4) = Symbol
        ActiveCell.Offset(0, 5) = Qty
        ActiveCell.Offset(0, 6) = FeeBps
        Sheets("Main").Activate
        ActiveCell.Offset(1, 0).Select
    Else
        ActiveCell.Offset(1, 0).Select
    End If
    Loop Until IsEmpty(ActiveCell)
End Sub
Attachments:
 
Excel Spreadsheet. 2 Worksheets (Main & DB).
 
 
Loading Advertisement...
 
[+][-]03.14.2008 at 10:02PM PDT, ID: 21131526

View this solution now by starting your 7-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

Zones: Microsoft Excel Spreadsheet Software, Microsoft Visual Basic.Net, Spreadsheet Software
Tags: VBA - Excel
Sign Up Now!
Solution Provided By: webtubbs
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628