ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   MIKE H i need more help (https://www.excelbanter.com/excel-discussion-misc-queries/245820-mike-h-i-need-more-help.html)

april

MIKE H i need more help
 
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
--
BDW

Mike H

MIKE H i need more help
 
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

"April" wrote:

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
--
BDW



All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com