A1=a1+x1

Shaikh Imtiyaz

New Member
Joined
Aug 6, 2017
Messages
1
Please help me sort out this problem as I need to use it everyday and it is really a headache if it goes wrong,

I have a target to sell 1500 units (A1) which is calculated on a daily achievement, suppose I achieved 50 units (A4) today and my till date achievement is 500 units (A2), the balance is 1000 units (A3), but what I achieved today should be added to (A2) and deducted from (A3) just by entering a new number in (A4) which is displayed till midnight only, after that this cell (A4) must be blank.

Every effort will be a helpful
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Ok here is my try. I have used arbitrary timing for this workbook trigger event i.e. 13:08:00. Of course you can use yours. Please feel free to modify code as per your formula or requirements. The basics are same. Copy and paste the code in "Workbook" portion.
Code:
Option Explicit


Private Sub Workbook_Open()
    Call ScheduleTask
End Sub




Public Sub ScheduleTask()
    Application.OnTime TimeValue("13:08:00"), "ThisWorkbook.Execute"
End Sub


Public Sub Execute()
    Debug.Print "Executing task", Now


Dim sh As Worksheet, wb As Workbook
Set wb = Application.ThisWorkbook


Set sh = Sheets("numbers")
    sh.Range("A4").Value = ""
    sh.Range("A2").Value = sh.Range("A1").Value - sh.Range("A3").Value
    
    Call ScheduleTask
End Sub
 
Upvote 0

Forum statistics

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