vba - Selecting rows in one column on the basis of a selected range -
i trying write macro formatting cells on basis of range selected in column. here want select rows in column b on basis of selected range in column a, i.e., want select portion in column b column has value. when run gives error "type mismatch"
i used code purpose:
sub macro2() dim lr long dim n long lr = range("a" & rows.count).end(xldown).row n = range("a1:a" & lr).specialcells(xlcelltypeconstants) range("b1:b" & n).select end sub i new in vba. appreciated.
thank you
your problem on line
n = range("a1:a" & lr).specialcells(xlcelltypeconstants) you have declared n long, specialcells returns range. not sure how fix this, can't tell trying do. first attempt
dim rng range set rng = range("a1:a" & lr).specialcells(xlcelltypeconstants) this should fix error.
Comments
Post a Comment