|
-
Dec 4th, 2000, 03:49 PM
#1
Thread Starter
Hyperactive Member
I have this code in my module that when the Reset Link is clicked it adds a formula to a cell:
Code:
Private Sub lblReset_Click()
Sheets("Employee Feed").Visible = True
Sheets("Employee Feed").Activate
Range("A3").Select
ActiveCell.FormulaR1C1 = "=REPLACE(A7,6,1," - ")"
End Sub
It comes up with an error:
"Type Mismatch"
What could the problem be??
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Dec 4th, 2000, 04:08 PM
#2
Hyperactive Member
Look at the following expresion:
"=REPLACE(A7,6,1," - ")"
What you´re doing is substracting two strings.
If things were easy, users might be programmers.
-
Dec 4th, 2000, 04:11 PM
#3
Lively Member
Argument type mismatching : string required!
David,
REPLACE worksheet function requires arguments with string data type, thus 6 should be "6" and 1 should be "1". Hence, a1 should be reformatted as text or u should convert A1 contents to string by using TEXT(A1,"format-string") ws function.
Best wishes with your work..
Kiziltan Yuceil
Freelance Web/VB/VBA Programmer
"It's not what you know it's to whom you consult and with whom you collaborate"
-
Dec 4th, 2000, 04:13 PM
#4
Lively Member
Another thing I detected..
You should use double quotes or chr(34) within formualae string..
ActiveCell.FormulaR1C1 = "=REPLACE(A7,6,1,"" - "")"
Kiziltan Yuceil
Freelance Web/VB/VBA Programmer
"It's not what you know it's to whom you consult and with whom you collaborate"
-
Dec 4th, 2000, 04:15 PM
#5
Thread Starter
Hyperactive Member
I'm not sure I understand. I am somewhat new to this. The thing is, I was using this before and it was working fine. I don't understand why it isn't working now
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Dec 4th, 2000, 04:16 PM
#6
Thread Starter
Hyperactive Member
OHHH. Ok. I got it to work. Thank you so much for your help.
Thank YOU
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|