Hi there. I've received help from here to get me so far but.......... I have a summary sheet which I run down and find data on some other sheet and copy back to the cell next to the ActiveCell. I then have the complication that the data is a formula so I found, and used
but that seems to make the focus change from what was the ActiveCell to the cell below the pasted one. Here is the version that works just great if what I am copying is data
.... and here's the bit I substituted to paste the value
I know I can 'Set' the ActiveCell and return to it but I just wondered if there were an elegant way to combine the 'smoothness' of
with the practicality of
If not it's not really a problem. Just thought I'd ask.
Many thanks.
Des.
Code:
.PasteSpecial Paste:=xlPasteValues
Code:
Sub TestDesFindCell2B()
Dim Found As Range
Dim ws As Worksheet
Dim count
Range("A1").Select
Do Until ActiveCell = ""
count = 0
For Each ws In ThisWorkbook.Sheets
With ws.Cells
Set Found = ws.Cells.find( _
What:=ActiveCell.Value, _
After:=ws.[A1], _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Found Is Nothing Then
If count > 0 Then
With Found.Offset(0, 1)
.Copy Destination:=ActiveCell.Offset(0, 1)
End With
GoTo line10 [COLOR=green]'I've already found a match so stop searching[/color green]
End If
End If
count = count + 1
End With
Next
line10:
Selection.Offset(1, 0).Select
Loop
End Sub
.... and here's the bit I substituted to paste the value
Code:
With Found.Offset(0, 1)
.Copy
ActiveCell.Offset(0, 1).PasteSpecial Paste:=xlPasteValues
End With
I know I can 'Set' the ActiveCell and return to it but I just wondered if there were an elegant way to combine the 'smoothness' of
Code:
.Copy Destination:
Code:
.PasteSpecial Paste:=xlPasteValues
Many thanks.
Des.