VBA define array text string count and return missing text -

IHSSS

New Member
Joined
Jul 12, 2017
Messages
1
HI
I am trying to put a code to open a file in another location find specific values (string) in a column count the numbers and return which values are missing from the column. I am stuck here
Private Sub CommandButton4_Click()

'Analyse FI Data
Dim mypath As String
Dim folderpath As String
Dim filename As String
Dim MyBook As Workbook, newbook As Workbook
Set MyBook = ThisWorkbook
Dim file As String, sheetdata As String
Dim ws As Worksheet
Dim x As Workbook
Dim y As Workbook
Dim FindString As String
Dim Rng As Range
Dim findrow As Integer


Dim finalrow As Integer
Dim bottomA As Integer
Dim c As Range
Dim TESTMarkitFI2015submitted As Worksheet
Dim FIANALYSIS As Worksheet
Dim a As Range
Dim col As Integer
Dim row As Integer
Dim cell As Integer
Dim inputbox As Variant
Dim application As String
Dim value As String
Dim iVal As Integer
Dim lastrow As Long
Dim i As Integer, icount As Integer

Dim rgFound As Range
Dim arr() As Variant
Dim rownumber As Integer
Dim countifstring As Integer
Dim Workbook As Workbook
Dim searchstring As Range
Dim name As Variant, cnt As Long
Dim MyObject As Object
Dim iteminreview As Workbook
Dim myarray As Integer

Dim bond As String
Dim promissoryNote As String
Dim loan As String
Dim certificatesOfDeposit As String
Dim embededOptionBond As String
Dim repo As String
Dim bondOption As String
Dim bondForward As String
Dim securedBond As String
Dim inflationLinkedBond As String

Set x = Workbooks.Open(filename:="Z:\Profiles\My Documents\MAPPING\TEST MAPPING TABLES\TEST_Markit_FI_2015 - submitted.csv")

worksheets("TEST_Markit_FI_2015 - submitted").Range("A:A").Select

rownumber = 0
countifstring = 0
'searchstring = Sheets("TEST_Markit_FI_2015 - submitted").Range("A:A")

Do
DoEvents
rownumber = rownumber + 1
'
'worksheets("TEST_Markit_FI_2015 - submitted").Range ("A:A" & "rownumber")

'
'iteminreview = Workbook("TEST MAPPING TABLES")

If Range("A:A", "bond", "promissorynote", "loan", "certificate of deposit", "embededOptionBond", "repo", "bondOption", "bondForward", "securedBond", "inflationLinkedBond") Then

countifstring = countifstring + 1


End If

Loop Until iteminreview = ""

MsgBox "the string occured:" & countifstring & "times"

For i = 2 To lastrow
lastrow = Cells(Rows.Count, 1).End(xlUp).row

Set rgFound = Range("A:A").Find("bond, promissorynote, loan, certificate of deposit, embededOptionBond, repo, bondOption, bondForward, securedBond, inflationLinkedBond") LookIn:=xlComments)


If Cells(i, 1).value = ("bond"), ("promissorynote"), ("loan"), ("certificate of deposit"), ("embededOptionBond"), ("repo"), ("bondOption"), ("bondForward"), ("securedBond"), ("inflationLinkedBond") Then

Debug.Print "Total number of bonds is:";


Workbooks("TEST_Markit_FI_2015 - submitted.csv").Close savechanges:=False


End If

Next

End Sub
 

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

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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