View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
alvin Kuiper alvin Kuiper is offline
external usenet poster
 
Posts: 175
Default loop and some more

Hi
I try to explain this very difficult task (for me)
I have this in a shet (perioder)
Here is 3 rows but there can bee up to 20 rows
B C D E F
G
39,22 39,22 02.01 28.02 02-01-2009 28-02-2009
47,17 47,17 01.03 31.10 01-03-2009 31-10-2009
44 44 01.11 31.12 01-11-2009 31-12-2009

then i have a userform with 2 fields as date (start and end)
What i want now is To make a loop there goes from 1 to 20
If my start is = ( F and the row) and end is <= (G and the row) Then
Take the value from B and copy it to another sheet = beregn

But thats not all :
If my start is 30-10 and my end is 02-11
Then i shall have 2 days with the value 39,22
and 2 days with the value 47,17
I have try this:
For I = 1 To 20

If Priskalk.fradato.Value = Range("perioder!" & kl & I).Value And
Priskalk.Tildato.Value <= Range("perioder!" & kl2 & I).Value Then
For s = Priskalk.fradato.Value To Priskalk.Tildato.Value
Range("beregner!" & kk & tal).Value = Range("perioder!" & kl3 & tal).Value
tal = tal + 1
Next
End If
If Range("perioder!" & kl & start).Value = "" Then
Exit For
End If
Next
Nothing happens ?????????

Hope someone can help
Alvin