View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

So if column B of that same row has something in it, don't do anything?

If column B is empty, then put that value entered into column A into column B?

If yes, then maybe this worksheet event:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub
If IsEmpty(Target.Offset(0, 1)) = False Then Exit Sub

On Error GoTo errHandler:
Application.EnableEvents = False
Target.Offset(0, 1).Value = Target.Value

errHandler:
Application.EnableEvents = True

End Sub


rightclick on the worksheet tab that should have this behavior. Select view
code and paste this into the code window. Then back to excel and test it out.

If you make a typing error in column A and column B is empty, then when you
correct that column A value, column B will still be incorrect--right?



rhay999 wrote:

Hi -

I'd be very grateful if someone can help me with a bit of macro code
that might achieve this. Really having trouble as my programming skill
is diabolical!!

I want to perform a "once only" calculation on rows of cells. When a
reference cell changes from blank to a value it will trigger a
calculation in another cell. When the reference cell changes
subsequenlty it will not affect the value in the calculated cell.

e.g.

Cell - Formula - Value
--------------------

Step 1
A1 blank
B1 =A1 value blank

Step 2
A1 value 10
B1 =A1 value 10

Step3
A1 value 20
B1 =A1 value 10 (stays at value 10 irrespective of value in A1)

This operation would need to be replicated through hundreds of rows.

Thanks in advance.

Richard

--
rhay999


--

Dave Peterson