Variable not defined

B

Barney

With this macro, why an I getting an error message that my variable 'mr' is
not defined? Isn't 'mr = ActiveCell.Row' my defining statement?

Sub MoveQuota()
mr = ActiveCell.Row
Range (Cells(mr, "c").Copy(mr, "d"))
Cells(mr, "c").Select
Selection.ClearContents
Cells(mr, "e").Select
Selection.ClearContents
End Sub

Thanks,

Barney
 
T

Tyro

If you have Option Explicit on, and it sounds like you do, you must define
every varible before use such as:

Dim mr as long

Using Option Explicit is good programming practice.

Tyro
 
Top