Hi, I thought I could do this thing but no. Therefore I'm looking for help from someone smarter than me.
I'm creating "adress labels" and "order labels" using VBA macro based on a list in matrix form.
I've used links to the list which I copy and paste to another sheet that's going to be printed by someone. Doing this all the way throug the list could take som time. Therefore I created a macro to do the job. I use the macro to edit/correct the links so the labels are made using every row.
In order to correct the links and use the next row i used a function (ExtractNumber, found on Ozgrid.com, thank you!) to extract numbers from strings. I converted the formula/link to a string and put it in a variable, Cformula.
I Dimmed my variable HNumber and tried to define it using the function which did not work. I get the error messag ByRef argument type mismatch. Actually no matter what I put in the () I get the same error message.
If I use the code below, there's no problem
Unfortunately there can be both 1, 2 and 3 digits. I could use a select case or if statement but I just want to understand why I'm having problems.
I'm creating "adress labels" and "order labels" using VBA macro based on a list in matrix form.
I've used links to the list which I copy and paste to another sheet that's going to be printed by someone. Doing this all the way throug the list could take som time. Therefore I created a macro to do the job. I use the macro to edit/correct the links so the labels are made using every row.
In order to correct the links and use the next row i used a function (ExtractNumber, found on Ozgrid.com, thank you!) to extract numbers from strings. I converted the formula/link to a string and put it in a variable, Cformula.
I Dimmed my variable HNumber and tried to define it using the function which did not work. I get the error messag ByRef argument type mismatch. Actually no matter what I put in the () I get the same error message.
Code:
HNumber = ExtractNumber(Cformula)
If I use the code below, there's no problem
Code:
HNumber = Right(Cformula,2)
Unfortunately there can be both 1, 2 and 3 digits. I could use a select case or if statement but I just want to understand why I'm having problems.