Sets data for an array of cells. For each cell in the array, you can either insert data or set the cell to Null.
If any of the specified cells are not writable, SetCells fails. For a similar method that does not fail when non-writable cells are encountered, use SetCells2. SetCells also returns the statuses of the cells. |
SetCells takes arrays of dimension member IDs as arguments, as well as an array of data for the cells to be set. These arrays must contain identical numbers of elements. The elements of the member ID arrays have a one-to-one correspondence to the elements of the data array.
SetCells passes the cells’ data in a Double array. To insert data into cells by passing a String array, use SetTextCells instead of SetCells. For more information, see SetTextCells. |
<HsvData>.SetCells varalScenario, varalYear, varalPeriod, varalView, varalEntity, varalParent, varalValue, varalAccount, varalICP, varalCustom1, varalCustom2, varalCustom3, varalCustom4, varadData, varabIsNoData
The following subroutine inserts data into cells; if 0 is passed for a cell’s data, the cell is set to Null. The cells’ dimension members and data are passed in the subroutine’s arguments. The subroutine constructs the array passed to SetCells’ varabIsNoData argument; if 0 is passed for a cell’s data, the corresponding item in the baNull array is set to TRUE.
Sub setCellsOrNull(laScen() As Long, laYear() As _ Long, laPer() As Long, laView() As Long, laEnt() As Long, _ laPar() As Long, laVal() As Long, laAcct() As Long, laICP() _ As Long, laCust1() As Long, laCust2() As Long, laCust3() _ As Long, laCust4() As Long, daData() As Double) Dim cData As HsvData, baNull() As Boolean 'g_cSession is an HsvSession object reference Set cData = g_cSession.Data 'Build the baNull array ReDim baNull(UBound(daData)) For i = LBound(daData) To UBound(daData) If daData(i) = 0 Then baNull(i) = True Else baNull(i) = False End If Next i cData.SetCells laScen, laYear, laPer, laView, laEnt, _ laPar, laVal, laAcct, laICP, laCust1, laCust2, laCust3, _ laCust4, daData, baNull End Sub