Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Change Formula in sheet by adding a new part

I have many formulas in a sheet like :

=ROUND('Revenue'!D$45*VLOOKUP($C116,ItemSplit!$A$1 :$B$50,2,FALSE),0)

If the the formula do not contain *Code!$C$47 (multiply by) at the end
of the formula i want to add it to all the formula in the sheet.

Can it be done using VBA or by find, replace function

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Change Formula in sheet by adding a new part

Hello,

A beginning of solution using VBA:
The active sheet must be the sheet where the formula to be changed are.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
Option Explicit

Sub AddToFormula()
Dim xR As Range, xF

For Each xR In ActiveSheet.UsedRange
xF = UCase(xR.Formula)
If Not IsNull(xF) Then
If Not (Len(xF) = 0) Then
If InStr(xF, "*CODE!$C$47") = 0 Then
xR.Formula = xR.Formula & "*Code!$C$47"
End If
End If
End If
Next xR

End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''







"Abdul" a écrit dans le message de groupe de
discussion :
...
I have many formulas in a sheet like :

=ROUND('Revenue'!D$45*VLOOKUP($C116,ItemSplit!$A$1 :$B$50,2,FALSE),0)

If the the formula do not contain *Code!$C$47 (multiply by) at the end
of the formula i want to add it to all the formula in the sheet.

Can it be done using VBA or by find, replace function

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Change Formula in sheet by adding a new part

Sorry, I have forgotten the most important:
to find the right formula to complete:

Option Explicit

Sub AddToFormula()
Dim xR As Range, xF

For Each xR In ActiveSheet.UsedRange
xF = UCase(xR.Formula)
If Not IsNull(xF) Then
If Not (Len(xF) = 0) Then
If InStr(xF, "45*VLOOKUP($") 0 Then
If InStr(xF, "*CODE!$C$47") = 0 Then
xR.Formula = xR.Formula & "*Code!$C$47"
End If
End If
End If
End If
Next xR

End Sub


"Charabeuh" a écrit dans le message de groupe de
discussion : ...
Hello,

A beginning of solution using VBA:
The active sheet must be the sheet where the formula to be changed are.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
Option Explicit

Sub AddToFormula()
Dim xR As Range, xF

For Each xR In ActiveSheet.UsedRange
xF = UCase(xR.Formula)
If Not IsNull(xF) Then
If Not (Len(xF) = 0) Then
End If
End If
Next xR

End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''







"Abdul" a écrit dans le message de groupe
de discussion :
...
I have many formulas in a sheet like :

=ROUND('Revenue'!D$45*VLOOKUP($C116,ItemSplit!$A$1 :$B$50,2,FALSE),0)

If the the formula do not contain *Code!$C$47 (multiply by) at the end
of the formula i want to add it to all the formula in the sheet.

Can it be done using VBA or by find, replace function

Thanks

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
Can Sheet name be part of formula for a cell (+ sheet name) Leslie Excel Worksheet Functions 1 March 9th 10 06:28 PM
Adding Multi-part Formula PhilosophersSage Excel Discussion (Misc queries) 3 October 6th 09 06:37 PM
change part of hyperlink formula Big Mac Excel Discussion (Misc queries) 3 February 4th 09 02:07 PM
change color of all cells with formula or are part of a formula [email protected] Excel Discussion (Misc queries) 19 January 28th 08 01:21 AM
Change part of formula [email protected] Excel Worksheet Functions 2 October 8th 06 08:50 PM


All times are GMT +1. The time now is 09:43 PM.

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"