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

move from active cell offset in macro 5
macro with If statement not working 2
do while loop problem 4
looping and stopping cont 1
F.A.O Mike H 3
Help ammendin some code 3
Conflict 8
Pivot table calculated field 3

Top