Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to add a row after a cell changes in value

Status
Not open for further replies.

nosremark

Technical User
Jan 29, 2003
69
US
I am using Excel to read data from a PLC application. I have it reading real time and all of the fields are changing properly. I want to write a macro that will initialize my "Update" routine, the initialize will happen when the value of cell E3 changes. The "Update" routine adds a row to the top of the table which reads the PLC data until E3 changes. I may not be getting my syntax correct, I am good in VB but have not done much work in Excel.

Thanks for any help.

nosremark
 
Hi,

If the value change in [E3] triggers the Worksheet_Change event, that's where you want to put the code...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim myRange As Range
    Set myRange = Application.Intersect(Target, Range("E3"))
    If Not myRange Is Nothing Then
        'run your macro
    End If
End Sub
Other than that, I have no good suggestions.

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top