excel - Option Explicit - Not sure how to dim this -
i have existing macro use format columns. i've been using without problems. now, i'm looking learn how use option explicit , running problem defining variable.
what should dim'ing level as? tried dim level string didn't work. i'm trying better understanding feedback appreciated.
option explicit sub adviseformat() dim form worksheet set form = sheets("formatting") form level = worksheetfunction.match("level", .rows("1:1"), 0) .columns(level).delete .columns("d:e").delete .range("u:u").value = range("e:e").value .columns("e").entirecolumn.delete .columns("f:i").delete .columns("i").delete .columns("l").delete .columns("m").delete form.range("a:b").entirecolumn.insert form.range("a1").value = "owner" form.range("b1").value = "comment" form.range("a1").interior.color = 65535 form.range("b1").interior.color = 65535 form.range("o1").interior.color = 65535 end end sub
as type worksheetfunction.match part, vba editor should pop , give clue return type. should like:
match(arg1, arg2, [arg3]) double
the "as double" part tells return type of match function. type should use declare level variable.
Comments
Post a Comment