Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Changing values in formulas with VBA

Hi!

I would need some help with this case.

I am trying to replace "7;faux" for "8;faux" in an excel formula. I
have this code, but it only searchs in the cells, not the formulas.

Range("H258:H390").Select
Selection.Replace What:="7;faux", Replacement:="8;faux", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

Could anyone let me know how to made it search in the formulas instead
of the cells?

Thanks alot!

Melanie


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Changing values in formulas with VBA

the crucial argument is missing

LookIn:=xlFormulas

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


mirca_00 wrote:

Hi!

I would need some help with this case.

I am trying to replace "7;faux" for "8;faux" in an excel formula. I
have this code, but it only searchs in the cells, not the formulas.

Range("H258:H390").Select
Selection.Replace What:="7;faux", Replacement:="8;faux", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

Could anyone let me know how to made it search in the formulas instead
of the cells?

Thanks alot!

Melanie


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Changing values in formulas with VBA

Replace does not look in formulas. Use search to find cells with
formulas (LookIn:xlFormulas) and then use the Replace function on the
formula of the found objects.

mirca_00 < wrote:
Hi!

I would need some help with this case.

I am trying to replace "7;faux" for "8;faux" in an excel formula. I
have this code, but it only searchs in the cells, not the formulas.

Range("H258:H390").Select
Selection.Replace What:="7;faux", Replacement:="8;faux", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

Could anyone let me know how to made it search in the formulas instead
of the cells?

Thanks alot!

Melanie


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing values in formulas with VBA

first there is no lookin argument for the replace command.

expression.Replace(What, Replacement, LookAt, SearchOrder, MatchCase,
MatchByte)

second, replace can only look at formulas. How would it replace the
displayed value of a formula. It can't. Constants in a cell are also
considered to be formulas.

So if you code isn't working it must have something to do with the string
you are trying to replace rather than a missing argument to the
function/method.

--
Regards,
Tom Ogilvy

"mirca_00 " wrote in message
...
Hi!

I would need some help with this case.

I am trying to replace "7;faux" for "8;faux" in an excel formula. I
have this code, but it only searchs in the cells, not the formulas.

Range("H258:H390").Select
Selection.Replace What:="7;faux", Replacement:="8;faux", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

Could anyone let me know how to made it search in the formulas instead
of the cells?

Thanks alot!

Melanie


---
Message posted from http://www.ExcelForum.com/



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
Formulas are changing into values Michael Bussey Excel Discussion (Misc queries) 1 May 8th 09 08:51 PM
changing formulas to their result values eejitrecords Excel Discussion (Misc queries) 1 August 19th 08 02:17 PM
Can't Stop Date Values from Changing to Formulas WillyV Excel Worksheet Functions 2 July 24th 07 12:09 AM
Changing Default Search in to Values Not Formulas in Excel Gregg Dotoli Excel Discussion (Misc queries) 1 January 1st 07 05:08 PM
Changing values but not formulas DestinySky Excel Worksheet Functions 1 February 17th 06 09:08 PM


All times are GMT +1. The time now is 03:14 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"