![]() |
Logic problem
Sub TEST()
Const limitDOWN As Date = #1/1/2007# Const limitUP As Date = #2/2/2007# Const isADP As String = "Y" Dim c As Range Dim d As Range For Each c In Worksheets("Instructions").Range("B7:B200").Cells If c.Value limitDOWN And c.Value < limitUP And _ c.Offset(0,4).Value = isADP Then With c.Offset(0,4).Font .Bold = True .Italic = True End With End If Next c -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "Janos" wrote in message ... Hello, Sorry again for the silly questions.... I'm a total VBA newbie. How do I link one operation with the other? looking at the code below, I'm trying to make sure that when condition 1 is satisfied (the one with the dates, using c) Condition 2 (the one that checks wether it is ADP, using d) is executed... but it should only be executed at the point of c. aka only if the date is right... do I assign the value of c to d before the for statement begins, or do i do a counter? Thank you for your help Sub TEST() Const limitDOWN As Date = #1/1/2007# Const limitUP As Date = #2/2/2007# Const isADP As String = "Y" Dim c As Range Dim d As Range For Each c In Worksheets("Instructions").Range("B7:B200").Cells If c.Value limitDOWN And c.Value < limitUP Then For Each d In Worksheets("Instructions").Range("F7:F200").Cells If d.Value = isADP Then With d.Font .Bold = True .Italic = True End With End If Next End If Next c |
All times are GMT +1. The time now is 07:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com