How to split the Amount in excel formula or Excel VBA Code?
Solved/Closed
Raj_1562
Posts
29
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 December 27, 2022 - May 31, 2021 at 12:12 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - May 31, 2021 at 12:12 PM
Related:
- How to separate dr and cr in excel
- Number to words in excel - Guide
- How to take screenshot in excel - Guide
- Gif in excel - Guide
- How to change date format in excel - Guide
- How to open excel in notepad - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
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