I have an excel workbook that I am trying to edit. The workbook was done years ago and the person who did it is long gone. The vba code inserts a formula into values when a command button moves the values from the input part of the sheet to the record keeping part of the sheet. That is, values are put in for various items for the week. At the end of the week you push a command button that moves the week numbers to an area of the sheet that keeps weekly totals for the year and when it does that it calculate percentages on some of those numbers. Currently the formula is: =IF(C7=0,0,D7/(C7). The vba is: xlS.Cells(intRow, 5).Formula = "=IF(C" & intRow & "=0,0,D" & intRow & "/C" & intRow & ")" I want to change the formula to : =IF(C7=0,0,D7/(C7-(N7+P7))) I thought the vba would be: xlS.Cells(intRow, 5).Formula = "=IF(C" & intRow & "=0,0,D" & intRow & "/(C" & intRow & "-(N" & intRow & "+P" intRow & ")))" but this is giving an "Compile error Expected: end of statement ". Any help would be great.
Bookmarks