Hi all,
Since this is my first post ever, i will try my best to describe my problem as understandable and structured as possible.
Feedback is of course highly appreciated.
The objective is to find a word in a range of cells and replace it by another word. No matter if the word which is to be found is capitalized or not.
Example. In cell is word "APPle-Pie", the part "APPle/apple/APPLE" (no matter of big or small) should be replaced by "Apple"
The code:
Idea:![]()
Sub text_replacement() Dim sh As Worksheet Dim i As Integer Dim j As Integer Set sh = Workbooks("replacement_naming_guidelines.xlsm").Sheets("Sheet1") For i = 1 To 7 For j = 1 To 3 sh.Cells(i, 1).Value = Replace(LCase(sh.Cells(i, 1).Value), sh.Cells(j, 2).Value, sh.Cells(j, 3).Value) Next j Next i End sub
Loop through list Cells (1-7,1), lower the cells with the replace function, see if part of word or entire word matches with Cells(1-3,2), and replace it by Cells(1-3,3).
Everything works fine, besides that even tho the list with the replacements Cells(1-3,3) contains capitalized letters, when replaced for words in Cells (1-7,1) they are often in small letters.
It gets completely strange when sometimes they are big and sometimes small.
I hope you understood the issue and one of you can help me.
Thank you anyway!
Stay tuned!
Bookmarks