View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Aaron1978[_20_] Aaron1978[_20_] is offline
external usenet poster
 
Posts: 1
Default Adding data to a cell via VBA


Hi again. I've come up against a small problem. When I enter a valu
into any cell in the A column, the function is run and the output i
written to the adjacent B column cell. However, when I delete the valu
in the A column I get an error and the spreadsheet no longer works.
have to close down the workbook and re-start excel. I'm assuming it i
because the function fnFractureVelocity is trying to read in an empt
value ffrm the A column.

Any help would be greatly appreciated.


Option Explicit

Dim BackFillConstant As Single
Dim FlowStress As Single
Dim Charpy As Single
Dim FractureArea As Single
Dim Pressure As Single
Dim ArrestPressure As Single
Dim cell As Range

Private Sub Worksheet_Change(ByVal Target As Range)

With Worksheets("Pipeline Data")
BackFillConstant = .Range("K").Value
FlowStress = .Range("FlowStress").Value
Charpy = .Range("CV").Value
FractureArea = .Range("A").Value
ArrestPressure = .Range("ArrestPressure").Value
End With
Pressure = Worksheets("Fracture Velocity").Range("A1").Value

If Target(1).Column = 1 Then
Application.EnableEvents = False
For Each cell In Target.Columns(1).Cells
If IsNumeric(cell) Then
cell.Offset(0, 1).Value
fnFractureVelocity(BackFillConstant, FlowStress, Charpy, FractureArea
Pressure, ArrestPressure)
End If
Next
End If

ErrHandler:
Application.EnableEvents = True

End Su

--
Aaron197
-----------------------------------------------------------------------
Aaron1978's Profile: http://www.excelforum.com/member.php...fo&userid=3120
View this thread: http://www.excelforum.com/showthread.php?threadid=54624