Question on creating a macro for repeat cell text

ExcelNewbieMacros

New Member
Joined
Apr 12, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am going to do my best to describe my question. Don't kill me as I am new to Excel lingo. I have attached a photo to better help me describe my question.

Here is my Excel spreadsheet that I use and the categories I created. The description is always what my bank categorizes the charges as, and they look similar to how they are listed. What I want is for a macro I can run where when it encounters the word "Macy"(just an example) in the description field. It will then automatically change the Payee/Remitter and the Payee Category to what is listed in the picture (shorted to Macy and added Retail). I have several repeat payments that are similar and want to automate the process. Soooo in short, I want to run a certain action (filling in Payee/Remitter and payee category) every time it sees a certain keyword in description. I know I would have to have it set for each keyword.

I hope some of that makes sense. If it doesn't or if what I am asking for is not possible that is also helpful to know.

Thanks for reading.
 

Attachments

  • Excel Question.JPG
    Excel Question.JPG
    72 KB · Views: 7

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Re: filling in Payee/Remitter and payee category
Where? Another Sheet? A few Columns to the right? At the bottom? In a Column with a specific Header?
Or just filter on a value.
 
Upvote 0
Re: filling in Payee/Remitter and payee category
Where? Another Sheet? A few Columns to the right? At the bottom? In a Column with a specific Header?
Or just filter on a value.
Were you able to see the attached photo? After the row marked "Description", I want it to condense it into the next column marked "payee/Remitter" and the next column after that marked "payee Category".
 
Upvote 0
OK, so if the desription Column has LOWES, under PAYEE/REMITTER you want Lowe's. No problem.
In your example it shows COURTHOUSE FITNE. Is this always going to show that like that or might it also be COURTHOUSE FITN if the reference number is longer?
You need to give a relation between when to use Retail, when to use Personal Care and whatever other categories you want.
Can you have another sheet, hidden maybe, where you have the relations etc in a range?
 
Upvote 0
Code:
Sub Start_Maybe()
Dim myArr, c As Range, i As Long
myArr = Sheets("Sheet2").Cells(1).CurrentRegion.Value
    For Each c In Range("D2:D" & Cells(Rows.Count, 4).End(xlUp).Row)
        For i = LBound(myArr) To UBound(myArr)
            If InStr(c, myArr(i, 1)) <> 0 Then
                With c
                    .Offset(, 1).Value = myArr(i, 2)
                    .Offset(, 2).Value = myArr(i, 3)
                End With
                Exit For
            End If
        Next i
    Next c
End Sub
 

Attachments

  • Sheet2.JPG
    Sheet2.JPG
    20.6 KB · Views: 6
Upvote 0
Can I delete the workbook made to test your problem?
 
Upvote 0

Forum statistics

Threads
1,215,162
Messages
6,123,382
Members
449,097
Latest member
Jabe

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