ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   While/Do Loop problem (https://www.excelbanter.com/excel-programming/379569-while-do-loop-problem.html)

MicrosoftNews

While/Do Loop problem
 
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.



Jim Cone

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


"MicrosoftNews"

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.



Jim Cone

While/Do Loop problem
 
http://www.cpearson.com/excel/newposte.htm


All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com