sql - BeforeDoubleClick to run Macro with the cell value as a variable -


the below code have in sheets ("view code") page , calls macro in module page. double click variable target reason doesn't pull it.

private sub gobeforedoubleclick3(byval target range, cancel boolean)   if intersect(target, range("a3:a1000")) nothing exit sub     lot = target.value     cancel = true     call lsrpull      'worksheets("lsr").activate end sub 

my first 2 events work fine simple go page macros.

private sub gobeforedoubleclick2(byval target range, cancel boolean)      if intersect(target, range("i3:i1000")) nothing exit sub         prc = target.value         cancel = true         worksheets("tools").activate         activesheet.range("$a$2:$g$3000").autofilter field:=2, criteria1:=prc  end sub   private sub worksheet_beforedoubleclick(byval target range, cancel boolean)     on error resume next     gobeforedoubleclick1 target, cancel     gobeforedoubleclick2 target, cancel     gobeforedoubleclick3 target, cancel     application.enableevents = true     end sub 

below code macro: im not sure if im suppose build sheet page or module code page.

sub lsrpull() '     application.screenupdating = false     application.calculation = xlmanual     dim sesora object    'declare object variable create instance view database     dim dbora object     'declare object variable open database     dim rsora object     'delcare object variable create snapshot of database      dim sql1 string      'declare string variable of sql query     'dim lottarget string      'dim adscexclude string      set sesora = createobject("oracleinprocserver.xorasession")     'sets database session     set dbora = sesora.opendatabase("mfginfo.world", "u_msas2/sa1sfby", 0)    'assign database session      sheets("lsr").select     range("$a$3:$m$65000").select             'selects possible previous data     selection.clearcontents         sql1 = " select count(reason) nmb, max(date), reason adsc, message_key tool "     sql1 = sql1 + " table"     sql1 = sql1 + " date > sysdate - 1/24 "     sql1 = sql1 + " , inventory  '%" & lot & "%' "     sql1 = sql1 + " group reason, message_key  "     sql1 = sql1 + " order max(date) desc "       set rsora = dbora.dbcreatedynaset(sql1, 0)  'sets snapshot of query script have written     rsora.copytoclipboard                       'copies snapshot of database clipboard     sheets("lsr").select     on error resume next     range("a3").pastespecial                    'pastes snapshot excel     range("a3").select     end sub 


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -