Variable not defined

  • Thread starter Thread starter Barney
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top