View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default FIND method , versus FOR EACH ...

With FromWks1
Set myRng1 = .Range("AT20:BW20")
End With
'.........

With FromWks1
Set c = myRng1.Find(what:=True, LookIn:=xlValues, _
lookat:=xlWhole)
If Not c Is Nothing Then
FirstAddr = c.Address
Do
.Cells(c.Row, c.Column).Copy _
Destination:=.Range(.Cells(c.Row, c.Column), _
.Cells(44, c.Column))
.Range("A1:N1").Copy
.Range(.Cells("1", c.Column), _
.Cells("14", c.Column)).PasteSpecial , _
Paste:=xlPasteValues, _
Transpose:=True
'........... another actions ...
Set c = .FindNext(after:=c)
Loop While Not c Is Nothing And c.Address < FirstAddr
End If
End With


"ytayta555" wrote:

A good day

I want to use FIND method instead my
old FOR EACH method in my code , I
think (and I have read) it will work faster .

Actually , my code look so :
......
With FromWks1
Set myRng1 = .Range("AT20:BW20")
End With
.........
For Each myCell In myRng1.Cells
If myCell.Value = True Then
With FromWks1
.Cells(myCell.Row, myCell.Column).AutoFill _
Destination:=.Range(.Cells(myCell.Row, myCell.Column), .Cells(44,
myCell.Column))
.Range("A1:N1").Copy
.Range(.Cells("1", myCell.Column), .Cells("14",
myCell.Column)).PasteSpecial , _
Paste:=xlPasteValues, _
Transpose:=True
........... another actions ...
End With
End If
Next myCell

Please very much to provide me this code ,
which shall use FIND method instead actually
method I use ; I need FIND to look only in my
range ( myRng1 = .Range("AT20:BW20") ).

Many thanks in advance !