Update DCount Criteria

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have an excel database with over 4,000 records. Each month, I have
to run 100 reports based on this data. Currently, I am using multiple
DCount Formula to filter the data. My problem is I to manulaly update
one of the Dcount Criteria fields before I print the report.

Specifially, I enter 1 in the first cell within the DCount Criteia. I
than print a report based on this data. I then enter 2 in the frist
cell and print a report. I do this for over 100 reports. Is there a
way to automate this process?

Thanks in advance.
 
How about recording a macro when you do it once to get the range addresses
straight.

Maybe something like this:

Option Explicit
Sub testme01()

Dim iCtr As Long
For iCtr = 1 To 3 '100
Worksheets("sheet1").Range("b2").Value = iCtr
Application.Calculate
Worksheets("sheet1").PrintOut preview:=True
Next iCtr

End Sub

I left it as print preview and for 1 to 3--didn't want to kill too many trees
while testing.
 
Thanks. It worked perfectly.


Dave Peterson said:
How about recording a macro when you do it once to get the range addresses
straight.

Maybe something like this:

Option Explicit
Sub testme01()

Dim iCtr As Long
For iCtr = 1 To 3 '100
Worksheets("sheet1").Range("b2").Value = iCtr
Application.Calculate
Worksheets("sheet1").PrintOut preview:=True
Next iCtr

End Sub

I left it as print preview and for 1 to 3--didn't want to kill too many trees
while testing.
 
Back
Top