In a PERSONAL.XLSB workbook, I have this code:
Public Sub Password(ByVal Target As Range)
a = ""
For n = 1 To Len(Target)
a = a & "*"
Next n
Target.NumberFormat = """" & a & """;""" & a & """;""" & a & """;""" & a & """"
End Sub
In my new workbook, I have this code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Info.Range("AA9").Address Then
Workbooks("PERSONAL.XLSB").Password Target
End If
End Sub
I keep getting an error saying, Compile error: Invalid use of property
Here's how you run a macro from your personal workbook:
Application.Run "PERSONAL.XLSB!Password", Target
[EDIT] It's worth noting that instead of a loop to build the * string, you could do this:
Public Sub Password(ByVal Target As Range)
Dim sMask as String
sMask = Mid(WorksheetFunction.Rept(";""" & String(Len(Target.Value), "*") & """", 4), 2)
Target.NumberFormat = sMask
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With