Basic question

dulitul

New member
Joined
Dec 13, 2012
Messages
16
Reaction score
0
Points
0
Hi guys,

I ve got one very basic question. I type the followig code:


Sub dad()
Dim ar As Range

For Each ar In Range("A1:B3")
If ar > 40 And ar < 200 Then
ar.Interior.Color = vbYellow
ar.Copy
Sheets("sheet2").Range("A1:B3").PasteSpecial

End If
Next ar
End Sub



What it does is to make all relevant numbers from my table in yellow. However, the second step - it just copies one of them and puts it in sheet2. I want to take all numbers between 40 and 200 from my list and paste them in sheet2..Any ideas??

Thanks
 
Code:
Sub dad()Dim ar As Range


    For Each ar In Range("A1:B3")
        If ar > 40 And ar < 200 Then
            ar.Interior.Color = vbYellow
            ar.Copy Sheets("sheet2").Range(ar.Address)
        End If
    Next ar
    
    Application.CutCopyMode = False
End Sub
 
Hey,

and if I want to paste in the activesheet starting from say A10? What should I do?

Thanks
 
Back
Top