> Thanks for the help but it wont accept my formula string.
That is is because there are problems with your formula string.
Firstly, no qiuotes are needed in the substring:
IF(B17='Y',C17,C16)
Secondly, where quotes are needed, it is necessary, in VBA, to double them.
Adjusting for these points, the following worked for me:
ActiveSheet.Range("G15").Value = _
"=IF(C16=""Enter Manual %age Below "",C17,IF(B17=Y,C17,C16))"
---
Regards,
Norman
"AliH" <nospamthanks@nospam.com> wrote in message
news:OzpN2GZmFHA.3448@TK2MSFTNGP12.phx.gbl...
> Thanks for the help but it wont accept my formula string.
> The message I get is RunTIme error 1004
> Application-defined or object defined error
> Any ideas what is wrong with this? It works ok if I just type it into the
> cell
>
> wks.Range("G15").Formula = "=IF(C16='Enter Manual %age
> Below',C17,IF(B17='Y',C17,C16))"
>
> Thanks again
> "Norman Jones" <normanjones@whereforartthou.com> wrote in message
> news:#cj9JxQmFHA.3336@tk2msftngp13.phx.gbl...
>> Hi Ali,
>>
>> Change:
>>
>> > wks.Protect Password = PWORD
>>
>> to
>>
>> wks.Protect Password:=PWORD
>>
>> I missed the required colon!
>>
>> ---
>> Regards,
>> Norman
>>
>>
>>
>> "Norman Jones" <normanjones@whereforartthou.com> wrote in message
>> news:Ohs%238tQmFHA.3900@TK2MSFTNGP09.phx.gbl...
>> > Hi Ali,
>> >
>> > Try something like:
>> >
>> > '======================>>
>> > Sub Tester05()
>> > Dim wks As Worksheet
>> > Static PWORD As String
>> >
>> > PWORD = InputBox("Please Enter Password")
>> >
>> > On Error Resume Next
>> > For Each wks In ActiveWorkbook.Worksheets
>> > wks.Unprotect Password:=PWORD
>> > wks.Range("G14").Formula = "???" '<<==== Your Formula
>> > wks.Protect Password = PWORD
>> > Next
>> >
>> > End Sub
>> > '<<======================
>> >
>> >
>> > ---
>> > Regards,
>> > Norman
>> >
>> >
>> >
>> > "AliH" <nospamthanks@nospam.com> wrote in message
>> > news:u1NmOnQmFHA.3256@tk2msftngp13.phx.gbl...
>> >>I have a workbook with lots of worksheets that all have the same layout
>> >>and
>> >> are protected.
>> >>
>> >> I want to make a change to a fomula in cell g14 on all the
>> >> spreadsheets
>> >>
>> >> How can I do this?
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Bookmarks