Macro to change amount of next bill and carry it forward

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,785
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

Ok so a bit of a strange one i'm doing a Billing cycle that shows how much is owed but i need to be able to adjust the amounts and could do with a macro to help.

So I have three ranges we take to take into account.

AC10:AC26 is my indicator for what we are goig to change.
Z10:Z26 & AA10:AA26 are amounts

So heres what I need.

I will press a buton and run the macro,
the macro will ask me "What figure do you want to change the payment to?" and I can put any figure I like including zero and minus

The macro then adjusts the next amount due to the figure ive said and adds the difference on to the next months figure.

So heres it in English if code could read it lol.

I run Macro,
Message Box "What figure do you want to change the payment to?" and gives me a place it input my amount.
I put an amount for example 1000, it then looks at the sheet down
AC10:AC26 finds the first row to have "No" in that column goes to that row in AA changes the amount to what i said and adds the difference to whatever was in the row below it.

Hope that makes senc, please help if you can

Thanks

Tony
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,920
Office Version
  1. 365
Platform
  1. Windows
How about
Code:
Sub tonywatson()
    Dim Fnd As Range
    Dim Inpt As Double, Dif As Double
    
    Inpt = Application.InputBox("Inptut an amount", , , , , , , 1)
    If Not Inpt = 0 Then
        Set Fnd = Range("AC10:AC26").Find("No", , , xlWhole, , , False, , False)
        If Not Fnd Is Nothing Then
            Dif = Fnd.Offset(, -2).Value - Inpt
            Fnd.Offset(, -2) = Inpt
            Fnd.Offset(1, -2) = Fnd.Offset(1, -2) + Dif
        End If
    End If
End Sub
 

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,785
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Thank you Fluff,
As always you are a great help :)

Tony
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
59,920
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,136,323
Messages
5,675,087
Members
419,549
Latest member
EliteBeat

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
Top