ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to enter a formula ? (https://www.excelbanter.com/excel-programming/338974-how-enter-formula.html)

Emory Richter

How to enter a formula ?
 
When I use:

Range("E1").Formula = "=A1*10"

No problem.

When I enter in the spread sheet:

=LEFT(A1,SEARCH(" - ",A1)-1)

No problem.

But when I use:

Range("E1").Formula = "=LEFT(A1,SEARCH(" - ",A1)-1)"

I get "Run-time error 13:.

How can I have VBA enter the second formula ?

Thank you,
Emory



Ron de Bruin

How to enter a formula ?
 
Hi

Range("E1").Formula = "=LEFT(A1,SEARCH("" - "",A1)-1)"

"" - ""
Double them

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Emory Richter" wrote in message m...
When I use:

Range("E1").Formula = "=A1*10"

No problem.

When I enter in the spread sheet:

=LEFT(A1,SEARCH(" - ",A1)-1)

No problem.

But when I use:

Range("E1").Formula = "=LEFT(A1,SEARCH(" - ",A1)-1)"

I get "Run-time error 13:.

How can I have VBA enter the second formula ?

Thank you,
Emory





Emory Richter

How to enter a formula ?
 
In article ,
says...
Range("E1").Formula = "=LEFT(A1,SEARCH("" - "",A1)-1)"

Thanks for your help, Ron
that solved the problem.

Emory

Tom Ogilvy

How to enter a formula ?
 
Range("E1").Formula = "=LEFT(A1,SEARCH("" - "",A1)-1)"

When you use double quotes within a text string you have to enter two double
quotes to get one.

--
Regards,
Tom Ogilvy



"Emory Richter" wrote in message
m...
When I use:

Range("E1").Formula = "=A1*10"

No problem.

When I enter in the spread sheet:

=LEFT(A1,SEARCH(" - ",A1)-1)

No problem.

But when I use:

Range("E1").Formula = "=LEFT(A1,SEARCH(" - ",A1)-1)"

I get "Run-time error 13:.

How can I have VBA enter the second formula ?

Thank you,
Emory





Emory Richter

How to enter a formula ?
 
In article ,
says...
quotes to get one.

Got it!
Thanks for the explaination, Tom

Emory


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com