ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Target Macro (https://www.excelbanter.com/excel-programming/426415-target-macro.html)

Workbook

Target Macro
 
Is there a macro that will scan every even cell in column F for contents and
when it finds contents it will do this (ActiveCell.FormulaR1C1 = "Target") in
the even cell next to it in Column G?

Mike H

Target Macro
 
Hi,

I don't really understand the question but this looks at every cell in the
used range of column F for the text 'Something" and if it finds it put Target
in column G

Sub sonic()
Dim LastRow As Long
Dim MyRange As Range
LastRow = Cells(Rows.Count, "F").End(xlUp).Row
Set MyRange = Range("F1:F" & LastRow)
For Each c In MyRange
If c.Value = "something" Then
c.Offset(, 1).Value = "Target"
End If
Next
End Sub

Mike

"Workbook" wrote:

Is there a macro that will scan every even cell in column F for contents and
when it finds contents it will do this (ActiveCell.FormulaR1C1 = "Target") in
the even cell next to it in Column G?


Workbook

Target Macro
 
This is very good. Thank you for you're help!

"Mike H" wrote:

Hi,

I don't really understand the question but this looks at every cell in the
used range of column F for the text 'Something" and if it finds it put Target
in column G

Sub sonic()
Dim LastRow As Long
Dim MyRange As Range
LastRow = Cells(Rows.Count, "F").End(xlUp).Row
Set MyRange = Range("F1:F" & LastRow)
For Each c In MyRange
If c.Value = "something" Then
c.Offset(, 1).Value = "Target"
End If
Next
End Sub

Mike

"Workbook" wrote:

Is there a macro that will scan every even cell in column F for contents and
when it finds contents it will do this (ActiveCell.FormulaR1C1 = "Target") in
the even cell next to it in Column G?



All times are GMT +1. The time now is 07:19 AM.

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