ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run a macro wehn leaveing a cell ?? (https://www.excelbanter.com/excel-programming/378125-run-macro-wehn-leaveing-cell.html)

Sparky AKA_Sparkticus

run a macro wehn leaveing a cell ??
 
Can this be implemented or is there a vba way
i have to in put mileage and calculate total mileage dont want to input a
large list just use one entry point.

i have a sum which is

mileage + previous total = total

i have used a macro to copy new total to previous and move curser to mileage
ready for a new input but is this the only way or can vab do this after
hitting enter on mileage??

Sparkyman








Nigel

run a macro wehn leaveing a cell ??
 
In the worksheet code add this (enter a new value in A1 and running total is
updated in B1
Change cells as required.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Range("B1") = Range("B1") + Target.Value
End If
End Sub

--
Cheers
Nigel



"Sparky AKA_Sparkticus" wrote in message
...
Can this be implemented or is there a vba way
i have to in put mileage and calculate total mileage dont want to input a
large list just use one entry point.

i have a sum which is

mileage + previous total = total

i have used a macro to copy new total to previous and move curser to
mileage
ready for a new input but is this the only way or can vab do this after
hitting enter on mileage??

Sparkyman










Bob Phillips

run a macro wehn leaveing a cell ??
 
Why not just add a formula to that other cell. It will update when the
target cell updates.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Sparky AKA_Sparkticus" wrote in message
...
Can this be implemented or is there a vba way
i have to in put mileage and calculate total mileage dont want to input a
large list just use one entry point.

i have a sum which is

mileage + previous total = total

i have used a macro to copy new total to previous and move curser to

mileage
ready for a new input but is this the only way or can vab do this after
hitting enter on mileage??

Sparkyman










Sparky AKA_Sparkticus

run a macro wehn leaveing a cell ??
 
Cheers that worked brilliantly

Sparkyman

Nigel wrote:
In the worksheet code add this (enter a new value in A1 and running
total is updated in B1
Change cells as required.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Range("B1") = Range("B1") + Target.Value
End If
End Sub


"Sparky AKA_Sparkticus" wrote in
message ...
Can this be implemented or is there a vba way
i have to in put mileage and calculate total mileage dont want to
input a large list just use one entry point.

i have a sum which is

mileage + previous total = total

i have used a macro to copy new total to previous and move curser to
mileage
ready for a new input but is this the only way or can vab do this
after hitting enter on mileage??

Sparkyman


--

There's no underestimating the intelligence of the American public.
H. L. Mencken (1880 - 1956)




Priya

run a macro wehn leaveing a cell ??
 
Hi

I have a same question and I guess you can help me out. I am not a VB
programmer but i know how to add code in Excel using VB

I want a formula to get copied uatomatically from the previous row when I
change/add a cell in column A of the worksheet.
What exactly I should write in VB worksheet function ?

Priya

Priya

run a macro wehn leaveing a cell ??
 
Hi

I have a same question and I guess you can help me out. I am not a VB
programmer but i know how to add code in Excel using VB

I want a formula to get copied uatomatically from the previous row when I
change/add a cell in column A of the worksheet.
What exactly I should write in VB worksheet function ?

Priya

"Nigel" wrote:

In the worksheet code add this (enter a new value in A1 and running total is
updated in B1
Change cells as required.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Range("B1") = Range("B1") + Target.Value
End If
End Sub

--
Cheers
Nigel



"Sparky AKA_Sparkticus" wrote in message
...
Can this be implemented or is there a vba way
i have to in put mileage and calculate total mileage dont want to input a
large list just use one entry point.

i have a sum which is

mileage + previous total = total

i have used a macro to copy new total to previous and move curser to
mileage
ready for a new input but is this the only way or can vab do this after
hitting enter on mileage??

Sparkyman












All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com