Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to add the following formual to a column of cells in Excel. The
code first goes through and counts the number of rows and then adds the formula. We have used this many time before but are unable to get this one to work. I have narrowed it down to it not working on the ones that use "*" and/or "/" in them. Can anyone help me with this? I posted this Friday and didnt get a response, so I am trying to clarifiy and simplify my question. Any and all help will be greatly appriciated. One that does work: Call InsertFormula(GetRowCount("C"), 15, "=IF(ISERROR(FIND(""$"",S#,1))=TRUE,P#,"""")") One that does not work: Call InsertFormula(GetRowCount("C"), 20, "=IF(AB#=""1"",S#,IF(AB#=""3"",N#/W#/100,""""))=SUM(T#*V#))") This is some of the code we use before using the lines above: Private Function GetRowCount(strColumn As String) As Integer Dim iCount As Long Dim i As Long For i = 1 To 65000 If Range(strColumn & i).Value < "" Then iCount = iCount + 1 Else Exit For End If Next GetRowCount = iCount End Function Private Sub InsertFormula(intRowCount As Long, intColumn As Long, strFormula As String) Dim ws As Worksheet Set ws = ThisWorkbook.ActiveSheet For i = 2 To intRowCount ws.Cells(i, intColumn) = Replace(strFormula, "#", CStr(i)) Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding cells with formulas | Excel Worksheet Functions | |||
Adding formulas | Excel Worksheet Functions | |||
adding formulas to blank cells | Excel Programming | |||
Adding cells that already have formulas | Excel Discussion (Misc queries) | |||
adding cells that contain formulas that have returned error messag | Excel Worksheet Functions |