excel - Find and Replace Logic -
hi have specific excel sheet list of 100+ queries in column. queries of format below:
select mkt_id,sum(nrx) $$current_quarter_table datamonth = $$current_quarter_datamonth
the $$ variables parameters intend replace on runtime. have mapping of these variables actual values in separate sheet in excel. like
variable|value $$current_quarter_table|bs_q3_sales $$current_quarter_datamonth|201606
now how should find , replace in vba? doing achieve this:
dim rng range set rng = config_params.range("c5:q17") 'range of variable value mapping cnt = 38 each cl in rng 'rng2.replace what:= cl.value, replacement:= replacestr = trim(config_params.cells(cl.row, 2) & "_" & config_params.cells(4, cl.column)) debug.print qry debug.print replacestr debug.print cl tmp = replace(cstr(qry), cstr(replacestr), cstr(cl)) cnt = cnt + 1 next
the values of variable used follows
sel count(distinct customer_id) $$ihc_curr_raw_dump customer_id null , cycl_time_id =$$ihc_prev_cycl_time $$ihc_curr_raw_dump ihc_exclusion_list
is there anyother optimized method achieve this? other strategy may use. appreciated. please point existing solution. not find specific problem.
Comments
Post a Comment