excel - Convert VBA code to run in vbscript -


this question has answer here:

i have vba code conditional formatting.

selection.formatconditions.add type:=xlcellvalue, operator:=xlnotbetween, _     formula1:="=$i$10", formula2:="=$j$10" selection.formatconditions(selection.formatconditions.count).setfirstpriority selection.formatconditions(1).interior     .patterncolorindex = xlautomatic     .color = 255     .tintandshade = 0 end      selection.formatconditions(1).stopiftrue = false end sub 

i have vbscript creates excel sheet , need apply vba code cell in excel sheet created. having issues getting run. know need sub actual values excel constants there's more don't get

what i've done far

     pricerange = "k"&rownum + 2      objworksheet.range(pricerange).formatconditions.add type:=1, operator:=2, formula1:="=$i$"&finalrownum + 1&"", formula2:="=$j$"&finalrownum + 1&""      objworksheet.range(pricerange).formatconditions(objexcel.selection.formatconditions.count).setfirstpriority      objworksheet.range(pricerange).formatconditions(1).interior.patterncolorindex = -4105      objworksheet.range(pricerange).formatconditions(1).interior.color = 255      objworksheet.range(pricerange).formatconditions(1).interior.tintandshade = 0      objworksheet.range(pricerange).formatconditions(1).stopiftrue = false 

i need apply conditional formatting specific cell (the 1 defined pricerange)

untested:

dim rng, fc, rownum, finalrownum, objworksheet  '... '... set rng = objworksheet.range("k" & rownum + 2)  'vbscript doesn't support named arguments, positional set fc = rng.formatconditions.add(1, 2, _                                  "=$i$" & finalrownum, _                                  "=$j$" & finalrownum) fc.setfirstpriority  fc.interior     .patterncolorindex = -4105     .color = 255     .tintandshade = 0 end  fc.stopiftrue = false 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -