PC Review


Reply
Thread Tools Rate Thread

Change Formula in sheet by adding a new part

 
 
Abdul
Guest
Posts: n/a
 
      22nd Feb 2010
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 With Quote
 
 
 
 
Charabeuh
Guest
Posts: n/a
 
      22nd Feb 2010
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" <(E-Mail Removed)> a écrit dans le message de groupe de
discussion :
16f53a88-2b6d-4e74-9495-329b626c5fe2...oglegroups.com...
> 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 With Quote
 
Charabeuh
Guest
Posts: n/a
 
      22nd Feb 2010
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" <(E-Mail Removed)> a écrit dans le message de groupe de
discussion : (E-Mail Removed)...
> 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" <(E-Mail Removed)> a écrit dans le message de groupe
> de discussion :
> 16f53a88-2b6d-4e74-9495-329b626c5fe2...oglegroups.com...
>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Sheet name be part of formula for a cell (+ sheet name) Leslie Microsoft Excel Worksheet Functions 1 9th Mar 2010 06:28 PM
Copying rows values on one sheet to part of a formula in a column onanother sheet. Manosh Microsoft Excel Discussion 2 23rd Jun 2009 03:58 AM
changing name of a sheet that's part of a formula friesen_brian@hotmail.com Microsoft Excel Misc 1 3rd Oct 2008 02:57 PM
How do I copy columns when part of formula has another sheet in it =?Utf-8?B?YW5kcmV3d2F0a2lucw==?= Microsoft Excel Misc 1 4th Nov 2007 11:59 PM
'Pulling through' part of a formula to use in another sheet raehippychick Microsoft Excel Misc 6 30th Apr 2004 08:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:37 PM.