strange behaviour
Hi Dave,
This might not help at all but I have experienced strange behaviour with
assigning ranges to variables when trying to do it in one line like the
following.
Set rLookUpRange = Sheets("identification").Range("a:d")
Changing code to following then worked perfectly. I have no explanation for
it because I would have thought that both are the same thing but the
following worked as expected and the above method didn't.
With Sheets("identification")
Set rLookUpRange = .Range("a:d")
End With
Also with the following code and loop to find the first blank cell. Are
there any other cells with data below the first blank one?
Set vNewrisk = Sheets("Treatment - Controls").Range("a8")
lLineCount = 8
Do Until vNewrisk.Value = "" ' look for first blank cell
Set vNewrisk = vNewrisk.Offset(1, 0)
lLineCount = lLineCount + 1
Loop
If no other cells below with data then you could do it this way without the
loop.
With Sheets("Treatment - Controls")
Set vNewrisk = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
lLineCount = vNewrisk.Row
--
Regards,
OssieMac
|