Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Infragistics Excel formula Query
posted

Hi,

We are using Infragistics Excel control, facing some issue how to copy First row formulas to all other rows with cell increment eg.

First Row formulas

K1=IF(D1="96","",A1)    L1=IF(D1="96","",B1) ,etc.,

same apply to 

K-L column copy for all rows having 1046 rows. formula should change all cell with row id eg K2 should have

K2=IF(D2="96","",A2)    L2=IF(D2="96","",B2) ,etc.,

Note: please share code sample with VB.net

Thanks,

Kumaran Krishnamurthi

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Kumaran,

    There does not exist a built-in way to copy a formula to each row of a Worksheet with a cell increment, but this behavior could be easily achieved using a loop. For example, the following code would achieve one of your “IF” formulas for the first 1046 cells:

            Dim workbook As Workbook = New Workbook(WorkbookFormat.Excel2007)
            Dim sheet As Worksheet = workbook.Sheets.Add("Sheet1", SheetType.Worksheet)
    
            For i As Integer = 1 To 1046 - 1
                Dim cell As WorksheetCell = sheet.GetCell("K" & i.ToString())
                Dim formulaString As String = "=IF(D" & i.ToString() & "=" & """96""" & "," & """""" & ",A" & i.ToString() & ")"
                cell.ApplyFormula(formulaString)
            Next

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.

Children