Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Learning Excel VBA

Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Learning Excel VBA

What' wrong in the following statement:?
Range("MF").Formula = "=" & Range("FRM1").Text


Assume the text is 'cow'. Then the formula is =cow, so Excel looks for
a function named 'cow' and can't find it.

Hth,
Merjet

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Learning Excel VBA

You probably want:

Range("MF") = Range("FRM1").Value


"merjet" wrote:

What' wrong in the following statement:?
Range("MF").Formula = "=" & Range("FRM1").Text


Assume the text is 'cow'. Then the formula is =cow, so Excel looks for
a function named 'cow' and can't find it.

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Learning Excel VBA


All of these, including the one you said didn't work, do work the same and
the last one will leave the formula instead of the value.

Sub vbaunderstand()
Range("mf") = ""
'Range("MF").Formula = "=" & Range("FRM1").Text
'Range("MF").Formula = Range("FRM1").Text

'Range("mf") = Range("frm1") 'simplest

Range("MF").Formula = "=FRM1" 'leave formula
end sub
--
Don Guillett
SalesAid Software

"Maurizio" wrote in message
...
Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Learning Excel VBA

Correction. Your first one does not work


--
Don Guillett
SalesAid Software

"Maurizio" wrote in message
...
Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Learning Excel VBA

Assuming Range("FRM1") contains the string ABC.

You want to produce something like

="ABC"

as written you produce

=ABC

Which makes excel look for a defined name ABC.
try

Range("MF").Formula = "=""" & Range("FRM1").Text & """"


--
Regards,
Tom Ogilvy


"Maurizio" wrote in message
...
Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Learning Excel VBA

Perhaps I didn't explain it clearly.
FRM1 is a named cell that contains something (inserted from previous macro
coding) like

LEFT(A43;5)

I need to assign it as a formula to all the cells of range MF that should
contain

=LEFT(A43,5)
Maurizio

"Tom Ogilvy" wrote:

Assuming Range("FRM1") contains the string ABC.

You want to produce something like

="ABC"

as written you produce

=ABC

Which makes excel look for a defined name ABC.
try

Range("MF").Formula = "=""" & Range("FRM1").Text & """"


--
Regards,
Tom Ogilvy


"Maurizio" wrote in message
...
Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Learning Excel VBA

Then the reason it doesnt' work is that your formula is written with a
semicolon and the formula method is looking for a comma.

Range("MF").Formula = "=" & Replace(Range("FRM1").Text,";",",")

should work.

Formulas entered through VBA using the formula property should use US
English conventions.

--
Regards,
Tom Ogilvy


"Maurizio" wrote in message
...
Perhaps I didn't explain it clearly.
FRM1 is a named cell that contains something (inserted from previous macro
coding) like

LEFT(A43;5)

I need to assign it as a formula to all the cells of range MF that should
contain

=LEFT(A43,5)
Maurizio

"Tom Ogilvy" wrote:

Assuming Range("FRM1") contains the string ABC.

You want to produce something like

="ABC"

as written you produce

=ABC

Which makes excel look for a defined name ABC.
try

Range("MF").Formula = "=""" & Range("FRM1").Text & """"


--
Regards,
Tom Ogilvy


"Maurizio" wrote in message
...
Please, would someone help me understand VBA?
What' wrong in the following statement:?

Range("MF").Formula = "=" & Range("FRM1").Text

the foloowing works correctly:

Range("MF").Formula = Range("FRM1").Text

Thanks for your time. Maurizio






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Excel Jinny M. New Users to Excel 7 March 26th 10 05:10 PM
Learning Excel Phyrst New Users to Excel 1 August 21st 08 09:08 PM
Learning VB for Excel AJ[_2_] New Users to Excel 10 March 16th 08 12:52 AM
Learning excel Simbie Le Charts and Charting in Excel 1 September 3rd 06 10:00 PM
Learning how to use Excel abfabrob Excel Discussion (Misc queries) 3 April 22nd 05 03:14 PM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"