excel - Trim returns error 424 object required -
i'm trying make function makes hyperlink 2 text fields. here's code:
option explicit sub addlink() dim mypath dim mychar dim integer dim mystring dim numbers dim siteid dim mywb dim siteaddress mypath = "somefilepath\" mychar = "\" = 2 4000 step 1 mystring = range("b" & i).value numbers = mystring.trimstart(mychar) siteid = range("f" & i).value mywb = "wo_" & numbers & "_" & siteid & ".xls" siteaddress = mypath & mywb activesheet.hyperlinks.add range("b" & i), siteaddress next end sub
so error on "numbers = mystring.trimstart(mychar)" - error 424 object required. i'm rly big noob @ vba, me? ps know should define variable type, when again f... errors drives me nuts.
that looks vb.net not vba. trim removes spaces. vba x = trim(str)
. maybe use instr
position of first backslash thenuse left
function.
Comments
Post a Comment