Test when value of an array is filled

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hello guys,

now I would need some helping hands with following UDF.

Code:
Function ReNrAendern(ByVal strText As String) As String
    Dim strOld(0 To 11) As Variant
    Dim strNew As String
    
    Dim i As Integer
    
    strOld(0) = "RE "
    strOld(1) = "RE. "
    strOld(2) = "RE: "
    strOld(3) = "Re "
    strOld(4) = "Re. "
    strOld(5) = "Re: "
    strOld(6) = "Rg "
    strOld(7) = "Rg. "
    strOld(8) = "Rg: "
    strOld(9) = "RG "
    strOld(10) = "RG. "
    strOld(11) = "RG: "

    strNew = "RNR. "
    
    For i = LBound(strOld) To UBound(strOld)
        strText = Replace(strText, strOld(i), strNew)
    Next i
    
    ReNrAendern = strText
End Function

So how can I test this code, what strOld array is used when I step through the code using F8

The reason behind this is that mostly the function replace how it intend to but with one case it replace the strText not the way I want it.
So I was trying to step through the code but not really find what array is used if the strText contains one of the strOld within the strText.

Hope I did explain this good enough and someone can give me a hint on that.

I guess it should be a watch added or? But with the watch I still was not sure how to find when it was driggert.
Or how to look for it correctly.

Many thanks
 
Last edited:
Hi guys,
I guess it is a little difficult as there are so many different type of ways people can write those Invoice Numbers and where the position is in the text.
So I guess I should try a different approach.
I think I am on the right track and let you guys know when I am back on track.

Sorry if I took your time but I do appreciate all your input and help on this issue.
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Will the R2012 (I presume the 2012 part can change) always appear at the end of the text like your examples show?
Yes those numbers are Invoice Numbers and I like to get those Invoice Numbers out of the text so I can track which Invoice has been paid.
:confused: In Message #21 I asked "Will the R2012 (I presume the 2012 part can change) always appear at the end of the text like your examples show?" and you answered "Yes those numbers are Invoice Numbers and I like to get those Invoice Numbers out of the text so I can track which Invoice has been paid." Because you answered "yes", I assumed that the numbers will always be at the end and my code was designed for that condition. If you are now saying your "yes" answer was not correct, then the code I posted cannot be used.
 
Upvote 0
Hi Rick,
I am sorry for this mistake. The way I had it set up there was in most cases at the end but again not in all the cells. If there are Invoice Numbers in it then there are mostly at the end.
Well I explain better.
This comes from a textfile a bankstatment. And I like to retrieve information out of the cell at the beginning cells could have a length of about 300 charakters and I like to get rid of all not needet and
get information whats needet out of this cell. So when I check this there are about 400 cells in one statement and it has to work in all statements so there is alot to look for. And always a new criteria to change.

So I am sorry I did not see that there where others.
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,085
Members
452,378
Latest member
Hoodzy01

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