View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default How to set up a delay to Private Sub Worksheet_Change(ByVal Target

Something like this:
Application.Wait Now + TimeValue("00:00:10")

So, it may evolve into:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$J$245" Then

Application.Wait Now + TimeValue("00:00:10")

(my macro code)


End If
End Sub

--
RyGuy


"gordom" wrote:

Hi,
I have a sheet with a pivot table. The data from pivot table report are
modified and imported to another range of cells. The layout of this
cells is changed by macro. If I triggered the macro manually it works
fine. The problem starts if I want to execute the macro automatically
when one of the cells is changed (I use "Private Sub
Worksheet_Change(ByVal Target As Range)" event). Unfortunately macro
corrupts data in that case. I suppose that macro starts modifying the
layout before all data are fully imported from the pivot. I tried to set
up some delay to the event but couldn't figure out how to do so. Could
you please help me? Thanks in advance.
gordom



my code syntax

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$J$245" Then


(my macro code)


End If
End Sub