excel - How do I use a sub from a different work book -


in personal.xlsb workbook, have code:

public sub password(byval target range)     = ""     n = 1 len(target)         = & "*"     next n     target.numberformat = """" & & """;""" & & """;""" & & """;""" & & """" end sub 

in new workbook, have code:

private sub worksheet_change(byval target range)     if target.address = info.range("aa9").address         workbooks("personal.xlsb").password target     end if end sub 

i keep getting error saying, compile error: invalid use of property

here's how run macro personal workbook:

application.run "personal.xlsb!password", target 

[edit] it's worth noting instead of loop build * string, this:

public sub password(byval target range)      dim smask string      smask = mid(worksheetfunction.rept(";""" & string(len(target.value), "*") & """", 4), 2)     target.numberformat = smask  end sub 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -