Who is the guru of string functions in excel

qosmioamit

New Member
Joined
Feb 17, 2011
Messages
4
Hello folks,

I have this code that compiles and runs with no errors but nothing happens. I manually do it and it works!
Code:
Sub fb34hunt()
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim L As Integer
Dim C As Integer
Dim S As Integer
Dim result As Long
Dim A As String
A = Sheets("Sheet5").Cells(4, 1)
Sheets("Sheet5").Cells(1, 4) = A & " faceplate's modules' history collection"
K = 1
For I = 2 To 7412
    result = StrComp(A, Sheets("phv").Cells(I, 1), 1)
    If result = 0 Then
        For J = 2 To 12139
            L = Len(Sheets("Sheet5").Cells(J, 3))
            C = InStr(1, Sheets("Sheet5").Cells(J, 3).Value, "/", 0)
            S = L - C
            If InStr(1, Sheets("Sheet5").Cells(J, 3).Value, Sheets("phv").Cells(I, 1).Value, 0) > 0 Then
                K = K + 1
                Sheets("Sheet5").Cells(K, 4) = Right(Sheets("Sheet5").Cells(J, 3), S)
            End If
        Next J
    End If
Next I
End Sub

Any help would be greatly appreciated :)
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
What do you mean by "If I manually do it"?

It is also a good idea to briefly explain what code is designed to do. Without that and with your code not doing what you want, it is difficult for a reader to know. ;)

Further, without knowing what your data (or a small sample) is like it is difficult to say much about why it is not doing what you want.

"Nothing happens" :confused:
Not even putting the text in cell D1 of Sheet5?

From a logic perspective, one reason that the main (I) loop may 'do' nothing is that each time through 'result' is never equal to 0.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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