Please help identify active row in DDE update of Excel spreadsheet Gary G 
Author Message
 Please help identify active row in DDE update of Excel spreadsheet Gary G

I need help with certain aspects of VBA code.  I receive data in Excel via Dynamic Data Exchange
from another program.

Data updates are unpredictable -- they may occur at any given moment and randomly affect any one
of several hundred rows in the Excel spreadsheet.

Whenever a given row is updated, I need to call VBA and compute some of my own statistics which
will be displayed in other columns of that same row.

I use the following routine to respond to arriving data:

        Sub TrapData()
        Worksheets("Sheet1").OnData = "Compute"
        End Sub

I have a fair amount of code in the Compute routine which uses .Offset to read and write data in
other columns of the active row.  My dilemma is how to accurately detect the actual row where
new data have just arrived.  What I am currently doing only detects the "active" row in which a
cell is visually highlighted on the screen, not where the data are actually coming in.  I am
using the following instructions:

        Sub Compute()
                Dim Rval As String
                For Each myRow In Selection
                Rval = myRow.Address
                        If Left(Rval, 2) = "$B" Then    'tests for data arriving in Col. "B"
                        Set L = mrRow.Offset(0, 0)
                        Set O = myRow.Offset(0, 1)
                        Set C = myRow.Offset(0, 2)
                        C.Value = L.Value - O.Value
                        End If
        End Sub

I know how to write the statistical code, but I am not sufficiently familiar with Objects,
Properties, and other mysteries of VBA.  I'm sure this is simple for you experts in VBA.  I hope
you will be kind enough to lend a helping hand.

Gary G.

Tue, 21 Nov 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Add a row to a spreadsheet using a MS Access DDE-link

2. Problem using DDE to Save Excel spreadsheet

3. Using DDE to open an Excel Spreadsheet

4. import specific rows from an excel spreadsheet

5. Add rows Programmatically to Excel Spreadsheet

6. Exporting Access Table via DDE to Excel - Please Help

7. DDE Problem (VB / Excel) - Please Help

8. Help with DDE to Excel, please!

9. Import an Excel Spreadsheet and Update 4 related tables

10. Prompts to update links when opening Excel spreadsheet from Access

11. VB4 / Excel 7 - Spreadsheet as DB wont update/refresh

12. Can't update Excel spreadsheet under Win95!?


Powered by phpBB® Forum Software