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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

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