Excel Help please

  Terry Brown 19:49 11 May 08
Locked

I am trying to set up a double ledger in Excel 2003. This is my problem.

E.g. I have a cell with £2000 and I want to move £200 to another cell, and have the first cell automaticy updated.

What I would Idealy like is a macro that when I click on a cell, shows the value, allows me to add-subtract and automaticly update it.

The cell the the money was moved from also to be updated.

Any suggestions Please
Terry

  VoG II 20:04 11 May 08

This is one of a number of possible solutions. Right click the sheet tab and select View Code. Copy and paste in


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim MoveAmount As Variant, MoveTo As Range
Cancel = True
MoveAmount = Application.InputBox("Enter amount to transfer", Type:=1)
If TypeName(MoveAmount) = "Boolean" Then Exit Sub
Set MoveTo = Application.InputBox("Select the destination cell", Type:=8)
MoveTo.Value = MoveTo.Value + MoveAmount
Target.Value = Target.Value - MoveAmount
End Sub



then close the code window using the X.

Now, to move an amount double click the cell that you want to move the money from. You will be prompted to enter the amount - just enter the number with no £ sign. If you double clicked the cell by accident just click the cancel button.

You will then be prompted for the cell to transfer the money to. You can either type in a cell address like A4 or simply click in the destination cell and click OK.

  Terry Brown 11:03 12 May 08

VOG

Thankyou. That is just what I need.
Terry

This thread is now locked and can not be replied to.

What is ransomware and how do I protect my PC from WannaCry?

What I learned from my mentor, Oscar-winning VFX supervisor Phil Tippett

Siri vs Google Assistant