Speed up this simple but fast code. Excel this.

GaryOfah

Board Regular
Joined
Feb 27, 2013
Messages
146
I was thinking because formulas are in D3:right...
But I can change them to be fix on lets say D3:G3. Or whatever the cells.

1.So if that can speed things up?

2.And I was thinking that someone can arrange those formulas on that range to pick them up from sheet into VBA code once automatically for start, until terminate - so to ease code to not copying them always. As array or string or whatever that method is called. Values also can be instantly after formulas calculated everything.
Probably, then DDE-handle can be first, then formulas calculate and directly into values.
Code is ok but needs more speed.

Thank you very much!
It is appreciated!
Code:
Sub DDE_Event()
    Dim NextRow As Long
    Dim LastCol As Long
    With ThisWorkbook.Worksheets("Sheet1")
        NextRow = .Range("C" & .Rows.Count).End(xlUp).Row + 1
        LastCol = .Range("D3").End(xlToRight).Column
        .Range(.Range("D3"), .Cells(3, LastCol)).copy .Range("D" & NextRow)
        .Range("C" & NextRow).Value = DDERequest(DDE_Handle, "something")
        With .Range(.Range("D" & NextRow), .Cells(NextRow, LastCol))
            .Value = .Value
            
        End With
    End With
End Sub
 
Last edited:
I have even add:
Code:
Application.CutCopyMode = False

After many rows code just slows down...
I have also restarted excel, restarted source app.
Nothing seems to work.
And CPU resources consumption is on much higher degree than at the start, although the updating speed is for sure - slower.

I believe it is the problem because of c/p formulas.
It' s probably too slow to go up and down and c/p.
Maybe also some other to me unknown problems...

Help please!
 
Upvote 0
DDE can be difficult to work with. (I am currently writing some code for DDE recent days). Not sure of your layout, but I have had memory problems etc with DDE. One was from poorly written code from a DDE provider that was allocating more and more memory as I let their code run in cells. It would eventually use all computer memory and crash my computer. They could not fix their code so I went with a more reliable DDE provider who I could work with to modify their interface with my Excel VBA usage of their DDE (speed and priority processes usage etc).

Even this DDE provider can at times slow down other processes on my computer depending upon various things. The solution I found was to occasionally clear cells that DDE formula cells referred to so their DDE data interface shuts off for all DDE cells, then reload same data so the DDE runs again. There seems to be something about DDE that can interfere with other processes occasionally. I have not always figured out why, but rather have used work arounds instead.

If you solved your above issues, I would be interested in hearing how you did it.
Thanks.
 
Upvote 0

Forum statistics

Threads
1,226,785
Messages
6,192,968
Members
453,770
Latest member
mwedom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top