K
K
I have two sheets one is call "Data" and other one is call "Search".
I have data (see below) in Sheets("Data")
A B C---- columns
555360 XX1 12
555360 - 555361 XX2 13
555360pg XX3 14
555360pg XX4 15
523600 GH5 16
523600 GH6 17
523600st GH7 18
589632 ZR2 19
589632tr ZR3 20
589632tr ZR4 21
I have macro (see below) set on a button in Sheets("Search")
Sub srch()
Range("A5:C50000").ClearContents
DataShRowCount = 1
SrchShRowCount = 5
Srchnum = Sheets("Search").Range("A1").Value
With Sheets("Data")
Do While .Range("A" & DataShRowCount) <> ""
If .Range("A" & DataShRowCount) = Srchnum Then
Set CopyRange = .Range("A" & DataShRowCount & ":C" & DataShRowCount)
CopyRange.Copy Destination:=Sheets("Search").Range("A" &
SrchShRowCount)
SrchShRowCount = SrchShRowCount + 1
End If
DataShRowCount = DataShRowCount + 1
Loop
End With
End Sub
When I put six digit number in Range("A1") of sheet "Search" like for
example if put 555360 and by clicking the button macro will look for
that number in column A of sheet "Data" and copy row from column A to
C of that six digit into sheet "Search". But sometime i have extra
characters with those six digits as show in above data. At the moment
when i put 555360 and click the button i get result (see below)
A B C---- columns
555360 XX1 12
but I want result some thing like this
A B C---- columns
555360 XX1 12
555360 - 555361 XX2 13
555360pg XX3 14
555360pg XX4 15
Macro should copy all those rows in which 555360 is appearing. And
also some time I have digit like 555360 - 555361 so if i put 555361in
"Search" sheet then macro should be able to find this row as well as
though these six digits are not starting from begining. I hope I was
able to explain my qestion. I know there is some code line needed in
above macro but I don’t know what. Can any friend can help
I have data (see below) in Sheets("Data")
A B C---- columns
555360 XX1 12
555360 - 555361 XX2 13
555360pg XX3 14
555360pg XX4 15
523600 GH5 16
523600 GH6 17
523600st GH7 18
589632 ZR2 19
589632tr ZR3 20
589632tr ZR4 21
I have macro (see below) set on a button in Sheets("Search")
Sub srch()
Range("A5:C50000").ClearContents
DataShRowCount = 1
SrchShRowCount = 5
Srchnum = Sheets("Search").Range("A1").Value
With Sheets("Data")
Do While .Range("A" & DataShRowCount) <> ""
If .Range("A" & DataShRowCount) = Srchnum Then
Set CopyRange = .Range("A" & DataShRowCount & ":C" & DataShRowCount)
CopyRange.Copy Destination:=Sheets("Search").Range("A" &
SrchShRowCount)
SrchShRowCount = SrchShRowCount + 1
End If
DataShRowCount = DataShRowCount + 1
Loop
End With
End Sub
When I put six digit number in Range("A1") of sheet "Search" like for
example if put 555360 and by clicking the button macro will look for
that number in column A of sheet "Data" and copy row from column A to
C of that six digit into sheet "Search". But sometime i have extra
characters with those six digits as show in above data. At the moment
when i put 555360 and click the button i get result (see below)
A B C---- columns
555360 XX1 12
but I want result some thing like this
A B C---- columns
555360 XX1 12
555360 - 555361 XX2 13
555360pg XX3 14
555360pg XX4 15
Macro should copy all those rows in which 555360 is appearing. And
also some time I have digit like 555360 - 555361 so if i put 555361in
"Search" sheet then macro should be able to find this row as well as
though these six digits are not starting from begining. I hope I was
able to explain my qestion. I know there is some code line needed in
above macro but I don’t know what. Can any friend can help