Selection of data

S

SMILE

Hi
I have the data from B8:F20 . I need to search in Col B8:B20 till i
find the letter "x". Suppose the letter "x" finds in B12 then I nee
to copy the data of B8:F11 and paste the value in another location.
need help in selecting the area by run a macro.
Thanks for the help
Tom
 
I

icestationzbra

i found your question a little ambiguous. howmuchever i coul
understand, here is a macro that does what i thought you needed. modif
according to your requirement.

Option Explicit

Sub CopyPasteOnX()

Dim rngCell As Range
Dim rngAll As Range

With Sheet1

Set rngAll = .Range("a:a")

For Each rngCell In rngAll

If rngCell.Value = "x" Then

rngCell.Resize(4, 10).Copy .Range("f25")

End If

Next rngCell

End With

End Sub

in your specific case:
1. you might need to change rngAll from A:A to B:B.
2. the resize argument takes two values, row and column. you ca
provide the number of rows and columns you need to copy.
3. in place of .Range("f25"), you might want to provide the top-lef
cell address of the region you want to copy to
 
Top