MIKE H i need more help

A

April

i posted a question regarding moving from active cells in a macro on 10/15.
Mike T replied and gave me the following macro to try
Try this

Sub loopthrough()
Dim MyRange As Range
Set MyRange = Range("T225:T234")
For Each c In MyRange
If c.Value = "General Research" Then
c.Offset(0, 15).Value = "MIT0000"
End If
Next
End Sub
i interpreted the c to mean cell and typed that into my macro. however, i
get a message that the "c" in line 3 is an undefined variable.

please help.

thanks in advance
 
M

Mike H

April,

Somewhere in your code it sounds like you have OPTION EXPLICIT set so you
need to dim C Like this

Sub loopthrough()
Dim C as range
Dim MyRange As Range
Set MyRange = Range("T225:T234")
For Each c In MyRange
If c.Value = "General Research" Then
c.Offset(0, 15).Value = "MIT0000"
End If
Next
End Sub


Mike
 

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

Similar Threads


Top