excel - VBA - Find cell that contains " " then populate cell after QueryTable loads -


so have issue, created loop find sheet says "standard deviation" , pull data 3 cells right of it. issue supposed pull data after query table loads. code won't work because runs before querytable loads.

sub stdb5() dim url string dim ws worksheet dim qt querytable dim mep worksheet dim symbol string set mep = worksheets("managed equity portfolios") set ws = worksheets("hidden sheet 3")  sheets("hidden sheet 3").cells.clearcontents sheets("hidden sheet 3").visible = true symbol = symbol & mep.range("b5").value  url = "https://www.google.com/finance?q=mutf:" + symbol  set qt = ws.querytables.add( _    connection:="url;" & url, _    destination:=ws.range("a1"))  qt.refresh  dim stdrange range dim cel range dim stdcell range 'std on mep set stdcell = mep.cells.range("h5")   'std on mep set stdrange = ws.range("a45:a50") each cel in stdrange     if cel.value = ("standard deviation")        stdcell.value = cel.offset(0, 3).value     end if next cel 

is there way make waits until query table loads before running? instead of having physically run macro again after table loads?

edit: reason need because after qt runs, standard deviation in, example, cell a45 instead of a47. makes can't make cell want populate ='sheet2'a45' edit 2: added whole code

what understand code wait sometime , run if correct can use application.wait(now + timevalue("0:00:05")). wait 5 second , execute next line.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -