While/Do Loop problem


M

MicrosoftNews

Hi all,

I need help on VBA in XL2003 / XP Home.

I want to add a additional function to a while/do loop. I want to check by
vba the saturdays AND sundays in my calendar and mark it.

################################################################
Private Sub TageFärben(DestTable As Worksheet, ByVal Kalenderjahr As
Integer)
Dim dat As Date
Dim AInterior As Interior

Set AInterior = TabPublics.Range(CFormatCellRange).Interior

dat = DateSerial(Kalenderjahr, 1, 1)
While Weekday(dat) <> vbSunday here I want to check also
the saturdays !!!!!!!!
dat = dat + 1
Wend
Do
SetzeTagesfarbeVonDatum dat, DestTable, AInterior
dat = dat + 7
Loop While Year(dat) = Kalenderjahr
End Sub
################################################################

Who can help ???

Thanks in advance.
 
Ad

Advertisements

J

Jim Cone

Maybe...
While Weekday(dat) <> vbSunday And _
Weekday(dat) <> vbSaturday
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"MicrosoftNews"
<[email protected]>
wrote in message
Hi all,
I need help on VBA in XL2003 / XP Home.
I want to add a additional function to a while/do loop. I want to check by
vba the saturdays AND sundays in my calendar and mark it.

Private Sub TageFärben(DestTable As Worksheet, ByVal Kalenderjahr As
Integer)
Dim dat As Date
Dim AInterior As Interior
Set AInterior = TabPublics.Range(CFormatCellRange).Interior
dat = DateSerial(Kalenderjahr, 1, 1)
While Weekday(dat) <> vbSunday 'here I want to check also the saturdays !
dat = dat + 1
Wend
Do
SetzeTagesfarbeVonDatum dat, DestTable, AInterior
dat = dat + 7
Loop While Year(dat) = Kalenderjahr
End Sub

Who can help ???
Thanks in advance.
 
Ad

Advertisements


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

Similar Threads


Top