excel - Pass VBA Sub a Range -
i keep getitng error "type missmatch"
i want able format cells in spreed sheet passing range , value i'd displayed.
can point out i'm going wrong?
sub layout() call create_box("a1:a2", 10) end sub sub create_box(r range, v string) dim box object set box = range(r) box .merge .value = box_value .horizontalalignment = xlcenter .verticalalignment = xlcenter .border.style = continous .border.color = black .border.weight = xlthick end end sub`
the parameter passing in not range object; string represenfting range object's local address property.
sub layout() activesheet '<-set explicitly sheets("sheet1") call create_box(.range("a1:a2"), 10) end end sub sub create_box(r range, v string) r .merge .value = box_value .horizontalalignment = xlcenter .verticalalignment = xlcenter .border.style = xlcontinuous .border.color = 0 .border.weight = xlthick end end sub
Comments
Post a Comment