How to split the Amount in excel formula or Excel VBA Code?
Solved/Closed
Raj_1562
Posts
31
Registration date
Wednesday August 26, 2020
Status
Member
Last seen
August 29, 2022
-
May 25, 2021 at 01:06 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - May 31, 2021 at 12:12 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - May 31, 2021 at 12:12 PM
Related:
- Vba split
- Vba case like - Guide
- Number to words in excel without vba - Guide
- Enable vba in excel - Guide
- Lg tv split screen - Guide
- Vba color index - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
549
May 31, 2021 at 12:12 PM
May 31, 2021 at 12:12 PM
Hi Raj,
The code below will change the input into expectation:
Not sure if you wanted to create a separate table and if the inputted values in column D could also be negative.
Best regards,
Trowa
The code below will change the input into expectation:
Sub RunMe() Dim lRow, x As Integer lRow = Range("B" & Rows.Count).End(xlUp).Row For x = lRow To 3 Step -1 Rows(x + 1).Insert Range("B" & x + 1).Value = 9999 If Range("C" & x) <> vbNullString Then Range("D" & x + 1).Value = Range("C" & x).Value * -1 End If If Range("D" & x) <> vbNullString Then Range("C" & x + 1).Value = Range("D" & x).Value Range("D" & x) = Range("D" & x) * -1 End If Range(Cells(x + 1, "B"), Cells(x + 1, "D")).Interior.ColorIndex = 6 Next x End Sub
Not sure if you wanted to create a separate table and if the inputted values in column D could also be negative.
Best regards,
Trowa