Find a Text VBA Code

fari1

Active Member
Joined
May 29, 2011
Messages
362
i want a code, that finds a text in column C i-e Description and copy the data below it,
the data in the rows after this word has to be copied with the below mrthod.

Description

AFruit
Apple
B Fruit
Mango
C Fruit
Orange

these A, B and C are in column 1, i want to get the values against B and C i-e just mango and orange from column C and get it pasted in sheet 2, the range can be long or short or even with no values after description
 
Last edited:
no, u dun need to combine the codes, just make this code run, just this one, your code is not copying the required cells
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
sorry my mistake, didn't change the sheet name, its copying but giving the wrong results, some mixed data
Here's my results? What should I have got?

Excel Workbook
A
9
1010-Q
1110-K
12
13
Sheet3
 
Upvote 0
out of this whole column,i need to get all the values of 10-K,10-Q,10-K/A,10-Q/A, no matter how many times they've repeated, i guess your code is picking up unique values, e.g if 10-K is repeated 10 times, then i need to have it 10 cells in sheet3,
sorry i think i didn't make it clear to u
 
Upvote 0
sorry i think i didn't make it clear to u
That's correct. You posted a sample data screen shot but not the corresponding results.


out of this whole column,i need to get all the values of 10-K,10-Q,10-K/A,10-Q/A, no matter how many times they've repeated,
Before I possibly go off in another wrong direction ..

1. Can you confirm how the start of the required data is located.
- Does it always start on row 14?
- Does it always start after the word "Filings" which could occur on different rows?
- Something else?

2. Are there other values in the column besides 10-K,10-Q,10-K/A,10-Q/A that need to be omitted from the results?
Or is the result just evertything in the column from below the start point?

Also, as a general technique, please try to gather your thoughts and make a single response post. When you make 3 posts in 5 minutes it is hard to keep up. Having read your first response I begin to prepare my response post only to later find I was doing so without all the information because you had made more posts.
 
Upvote 0
Code:
Sub ooData()
    Dim wsInput As Worksheet, wsOutput As Worksheet
    Dim wsInputLRw As Long, i As Long
    Dim RngSource As Range
    
    On Error GoTo Whoa
    
    Application.ScreenUpdating = False
    
    Set wsInput = Sheets("info")
    Set wsOutput = Sheets("prof")
    
    wsInputLRw = wsInput.Range("A" & Rows.Count).End(xlUp).Row
    
    For i = 6 To wsInputLRw
        Select Case UCase(wsInput.Range("A" & i).Value)
        Case "10-K", "10-Q", "10-K/A", "10-Q/A"
            If RngSource Is Nothing Then
                Set RngSource = wsInput.Range("A" & i)
            Else
                Set RngSource = Union(RngSource, wsInput.Range("A" & i))
            End If
        End Select
    Next i
    
    If Not RngSource Is Nothing Then _
    RngSource.copy wsOutput.Range("A10")
LetsContinue:
    Application.ScreenUpdating = True
    Exit Sub
Whoa:
    MsgBox Err.Description
    Resume LetsContinue
End Sub


this was the code, that i wanted, thanks alot for your help anyways peter. u have been a great support
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,237
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top