The why is because you don't qualify the "Range("H26")" after "Then"
with the name of the sheet, so
Range("H26").Select
is equivalent to
ActiveSheet.Range("H26").Select
However, you could avoid this problem (and be far more efficient) if you
didn't rely on Selections at all:
With Sheets("data Worksheet").Range("H26")
If .Value > 0 Then _
Sheets("Test Database").Range("F9").Value = .Value
End With
Note the "." before .Value which indicates that the property belongs to
the object in the With statement (i.e., Sheets("data
Worksheet").Range("H9")).
> I need help with an if then else macro
>
[quoted text clipped - 15 lines]
>
> Eric
JLGWhiz - 13 Nov 2007 19:53 GMT
JE said:
Note the "." before .Value which indicates that the property belongs to
the object in the With statement (i.e., Sheets("data
Worksheet").Range("H9")).
But I think he meant:
Note the "." before .Value which indicates that the property belongs to
the object in the With statement (i.e., Sheets("data
Worksheet").Range("H26")).
> The why is because you don't qualify the "Range("H26")" after "Then"
> with the name of the sheet, so
[quoted text clipped - 36 lines]
> >
> > Eric