Problem with do while

chriswernau

New Member
Joined
Sep 3, 2014
Messages
2
Hi,
I have got problem with loop. I fill the row with workdays from current month and I would like to stop doing that, before it add a date from next month.
So, first possibile condition would be somenthing like that : month(myird)>month(Now())
Or second. One row above I've got these days and at the end of the row is string cell "Summe", so the loop may stop, when encounters this cell.


Function Filltable(adresse As String, rownumber As Integer)

Dim kolumn, m As Double

For kolumn = 3 To 25
Do While Cells(rownumber - 1, kolumn).value = "Summe"
m = m + 1
myird = Format(WorksheetFunction.WorkDay(Int(Now()), -2 + m), "dd/mm/yyyy")
Cells(rownumber, kolumn) = "=" & Chr(39) & myird & Chr(39) & "!" & Range(adresse).address
Loop
Next kolumn

End Function

Any sugestions?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,811
Messages
6,181,082
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top