Find Text Code Amendment

Status
Not open for further replies.

fari1

Active Member
Joined
May 29, 2011
Messages
362
Code:
Sub findBalance()
    Dim f As Range, fa As String, i As Long
    Dim src As Worksheet, dst As Worksheet
    Set src = Sheets("sheet2") 'sheet to be searched, change as required
    Set dst = Sheets("sheet3") 'sheet for output, change as required
    i = 2
    With dst
        .Range("A1") = "output"
        Set f = src.Cells.Find(What:="CONSOLIDATED", After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False)
        If Not f Is Nothing Then
            fa = f.Value
            Do
                If Len(f.Value) < 50 Then
                    .Cells(i, "A") = fa
                    i = i + 1
                End If
                Set f = src.Cells.FindNext(f)
            Loop Until fa = f.Value
        End If
    End With
End Sub

hi, my above code is not giving as output those cells in which cell values are starting with the word balance e.g balance sheet, its only providing the cell address of the cells which contain the word balanace within it, e.g notes to balance sheet.
Also this code is just the providing the cell address for the values from column A, while i want it to loop through the whole worksheet, every column <!-- / message --><!-- sig -->
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Status
Not open for further replies.

Forum statistics

Threads
1,224,592
Messages
6,179,787
Members
452,942
Latest member
VijayNewtoExcel

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