VBA codes to convert number value in column D to negative based on corresponding Text in column B

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
719
Office Version
  1. 2010
Platform
  1. Windows
Can someone post VBA codes to convert number value in column D to negative if corresponding text in column B contains the word Credit or Payment.

Book1
ABCDE
1DateDescriptionClassCostCost to date
207/01/23Charge - RUBS Debra24.49(2,285.85)
307/01/23Credit - Valet Trash - Debra(9.07)(2,310.34)
406/02/23Payment - eCheck Mike(1,117.97)(2,301.27)
506/01/23Credit - RUBS - Electric - Debra(70.09)(1,183.30)
606/01/23Charge - RUBS - Electric - Debra32.57(1,113.21)
706/01/23Credit - Valet Debra(25.58)(1,145.78)
805/02/23Payment - eCheck Mike(1,132.58)(1,120.20)
905/01/23Charge - RUBS Debra12.3812.38
Sheet1
Cell Formulas
RangeFormula
E2:E9E2=E3+D2


Thank you.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi:
The VBA code in post #9 returns the required values based on the worksheet layout in post #1, but the worksheet layout has changed. Column B is now column D, and column D is now column E. Additionally, there is no longer a need to evaluate for "Payment." Could you update the code to reflect the new worksheet layout? Thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
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