View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
steve_doc steve_doc is offline
external usenet poster
 
Posts: 140
Default "If formula" within a loop

one possible way!

Assumption : search column has no blank values in it!
Dim ws as Worksheets
Dim rg as Range

Set ws = ThisWorkbook.Worksheets("your sheet name")
Set rg = ws.Range("your range start")

Do until IsEmpty(rg)
If rg = 'your value' Then
Range("AP2:AZ2").Select
Selection.Copy
Range("AP12:AZ12").Select
ActiveSheet.Paste
Else
Set rg = rg.Offset(1,0)
End If
Loop

Above is untested so may have 1 or 2 bugs in. Also would be a better idea to
tidy up the Select statements

HTH
Steve

"BigWave@AC" wrote:

I am looking for a way to create a macro that will search though a
column and when it encounters a specific value it performs the
following function.

If EA12 = 1 Then
Range("AP2:AZ2").Select
Selection.Copy
Range("AP12:AZ12").Select
ActiveSheet.Paste

I have not been able to successfully use any looping methods to this
point. Any Ideas?