[VBA] Dim MyRng, Cell, CELLS As Range
Dim HRRow, OPCol, StCol, FINCol, RollNo As Range
Dim a, b, c, d, e, f As Long
Set MyRng = ActiveSheet.Range("T7:AL25") ' where i need 1 or 2 inserted depending if B7:B25 has EMPTY IN
Set RollNo = ActiveSheet.Range("B7:B25") 'COL B = ROLL NO
Set HRRow = ActiveSheet.Range("l5:gy5") 'L5:GY5 = HOUR LINE
Set FINCol = ActiveSheet.Range("k7:k25") 'COL K = FIN HOUR
Set OPCol = ActiveSheet.Range("i7:i25") 'COL I = HOURS OP PER ROLL
Set StCol = ActiveSheet.Range("j7:j25") 'COL J = START HOUR
b = HRRow
c = StCol
d = FINCol
For Each a In RollNo
If a.Value = "EMPTY" And b.Value >= c.Value And b.Value <= d.Value Then
MyRng.Value = 2
End If
Next a
'IF(AND(hrrow >= stcol,hrrow <= fincol),2,"")
'IF(AND(hrrow >= stcol,hrrow <= fincol),1,"")
End Sub
'=IF($B7="EMPTY",IF(AND(hrrow >= stcol,hrrow <= fincol),2,""),IF(AND(T$5>=$J7,T$5<=$K7),1,"")) ACTUAL FORMULA IN EACH CELL
[/VBA]
i am trying to check with this formula above in VBA : Basically if col B7:B25 is greater than "" then IF(AND(hrrow >= stcol,hrrow <= fincol),1,"")
if B7:B25 is greater than blank and = "EMPTY" then this
IF(AND(hrrow >= stcol,hrrow <= fincol),2,"")
can anyone tell me where i am going wrong please
Thanks
Nick