Mettre une pause pendant le chargement d'une fonction

Bonjour,

J'ai besoin de faire patienter l'application le temps que mes fonctions Bloomberg soient chargées sur la page.

j'ai essayé le .Wait mais ne fonctionne pas.... J'ai affecté ce qu'il y a apres les "======" sur un bouton en attendant de trouver la solution à mon probleme et cela fonctionne mais j 'aimerai pouvoir utiliser tout cela en un seul clique

voici mon code:

Option Base 1

Sub RechercheBonds()

ThisWorkbook.Worksheets("cover").Filtrer.Caption = "2 - Please wait"
Call retardement(True)

Application.ScreenUpdating = False

'Variables pour le programme
Dim tickerB As String
Dim tickerE(40) As String
Dim stopflag As Boolean
Dim i As Long
Dim j As Long
Dim name As String
Dim ws As Worksheet
Dim wbini As Worksheet

'Variables du Bchain
Dim chaintype As String
Dim filters As String
Dim family As String
Dim formule As String
Dim equi As String
'Dim oustanding As String
'Dim maturity As String

'initialisation
tickerB = Range("Ticker").Value
stopflag = False
i = 2
j = 1
name = Worksheets("Liste").Cells(i, 8).Value
chaintype = Chr(34) & "Bonds" & Chr(34)
filters = Chr(34) & Chr(34)
family = Chr(34) & "IssuedBy = CREDIT_FAMILY" & Chr(34)
equi = " EQUITY"
Set ws = ThisWorkbook.Worksheets("Data2")
Set wsini = ThisWorkbook.Worksheets("Cover")

If wsini.Range("Ticker") = wsini.Range("CurrentTicker") Then Exit Sub   'on ne fait rien si on a deja extrait la base de données

ws.Activate
ws.Range("A2").Select
ws.Range(Selection, Selection.End(xlDown)).Select
Selection.Clear

Do While name <> ""

    If name = tickerB Then
        j = 1
        listflag = False
        Do While tickerE(j) <> "" And Not (listflag)
            If tickerE(j) = Worksheets("Liste").Cells(i, 9).Value Then
            listflag = True
            End If
            j = j + 1
        Loop
    If Not (listflag) Then tickerE(j) = Worksheets("Liste").Cells(i, 9).Value
    End If

    i = i + 1
    name = Worksheets("Liste").Cells(i, 8).Value

Loop

'préparation de la formule pour le Bchain

'oustanding = Chr(34) & "AMT_OUTSTANDING >= " & Range("OutstandingMin").Value * 1000000 & " AND AMT_OUTSTANDING <= " & Range("OutstandingMax").Value * 1000000

'maturity = "MATURITY >= 2017-12-07" & Chr(34)

'filters = oustanding & " AND " & maturity
If tickerE(1) = "" Then
MsgBox ("Invalid Ticker")

Else
filters = Chr(34) & Chr(34)

formule = "=BChain(" & Chr(34) & tickerE(1) & equi & Chr(34) & ", " & chaintype & ", " & filters & " , " & family & ")"

'filtrer l'extraction de bonds

ws.Activate
ws.Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Clear
ws.Range("A2").Value = formule

End If

wsini.Activate
wsini.Range("Ticker").Select

'===========================================================BESOIN DE FAIRE ATTENDRE LE CHARGEMENT==========================================
Range("F3").Select
    Selection.Copy
    Range("D29").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Dim sup As Range
Dim lig As Single, lig_max As Single

    With ActiveWorkbook
        tkr = .Sheets("Cover").Range("D29").Value
        lig_max = .Sheets("Data2").UsedRange.Rows.Count
        For lig = 2 To lig_max
        Worksheets("Data2").Select
            tlist = .Sheets("Data2").Cells(lig, "C").Value
            If tlist <> tkr Then
                If sup Is Nothing Then Set sup = Rows(lig) _
                Else Set sup = Union(Rows(lig), sup)

            End If

        Next lig
    End With

sup.Delete

    Worksheets("cover").Range("D29").Delete

Worksheets("cover").Select

MsgBox "All Datas are now corresponding to the initial ticker"

Application.ScreenUpdating = True

End Sub

Merci pour toute aide de votre part

Bonjour whereisbryan,

Je suggère "application.ontime". Explications sur la page :

https://msdn.microsoft.com/fr-fr/library/office/ff196165(v=office.14).aspx

Bonjour GVIALLES!!

Merci beaucoup ca fonctionne parfaitement!

Rechercher des sujets similaires à "mettre pause chargement fonction"