Most Urgent----CONVERT FORMULA INTO CODE

fari1

Active Member
Joined
May 29, 2011
Messages
362
Hi, i want to convert my below formula to code, which loop through entire column A and bring me those rows which contain 10-(along with there can be anything).
Code:
=INDEX($A$2:$A$401,MATCH("10-*",$A$2:$A$401,0))

urgent help is required
 
i guess it is a function, i dont know how to run a function, will u plz guide
That is not a function. Looking at the other thread where you had posted your requirement, following code should do fine.

Step 1) Right click on Sheet1 tab, choose "View Code". VBA module will be opened.
Step 2) Paste the following code in it:
Code:
Public Sub FindData()
Dim lLastRow As Long
With Sheet1
lLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lLastRow
        If InStr(1, .Range("A" & i).Value, "10-") > 0 Then
        .Rows(i).Copy Destination:=Sheet2.Range("A" & Rows.Count).End(xlUp)(2)
        End If
    Next i
    Application.CutCopyMode = False
End With
End Sub
Step 3) Stay on Sheet1 and run the code and see if this is what you were after.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I've shown the link for my data in my earlier post and want u to check it plz, to get idea why its not working
 
Upvote 0
I had seen your other post and have tested that data. It works fine here!

1. Does the code give any error? Or it just runs and doesn't do a thing.

2. Have you renamed any of these sheets?
 
Upvote 0
Its just runs and does nothing, and the sheet names i've not changed, they'r same, i'm unable to find:(
 
Upvote 0
That's intriguing, does the column A contain the specified data or is it in some other column?
 
Upvote 0
its just on column A and no where else, can u give me email id, i'll email u, or u email me, and i'll provide u my email id
 
Upvote 0
You have to spell everything out for her. Including the worksheet names.
Code:
Sub FindData()
Dim lLastRow As Long
With Worksheets("Filings")
lLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lLastRow
        If InStr(1, .Range("A" & i).Value, "10-") > 0 Then
        .Rows(i).Copy Destination:=Sheet2.Range("B" & Rows.Count).End(xlUp)(2)
        End If
    Next i
    Application.CutCopyMode = False
End With
End Sub
 
Upvote 0
thats great kevin,u just came in and telling him about my qualities, gud,

anyways taurean, your code is working in a separate worksheet, but not running in my workbook,i've to check it, may be some setting has to be changed, thanks alot for your help
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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