Using for next with two counters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

Im trying to use a for next statement with two counters.
What i have so far:

DDRowCount and DateCount1 are variables defined earlier.
say DDRowCount = 4 and DateCount1 = 5
DataRange is a variable too, of the rows of data.

For n = 1 To DRRowCount
For d = 1 To DateCount1 + 5
DataRange.Cells(n, d).Value = "test"
Next d
Next n

This doesn't seem to be working.
Can i please ask for some help on this.

Cheers.
Alby
 
Albert,

Always use Option Explicit as the top of your modules.
Doing that would quickly point out that...

DDRowCount is not the same as DRRowCount
It works for me after making the correction.

Regards,
Jim Cone San Francisco, CA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top