I'm new to VB6 (I Know... it's very old but its what we still use)
I'm having an issue with one of the old grids I have to make changes to. As you can see in the image below this grid is designed in the Spread Designer and what I need to do is simply have the "Change" columns selected by default when the form loads up. I have searched here where I can change the properties for this column and the only thing I have found so far is the Cell Type pop-up when I right-click and click on edit.
Anyone can point me in the correct direction here?
I believe this is where I might have to make any changes.
Private Sub GrdPriceChanges_LeaveCell(ByVal Col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)
Dim VatRate As Variant
Dim CostPrice As Variant
Dim SellPrice As Variant
Dim vData As Variant
Dim Margin As Variant
If Col = 9 Then
GrdPriceChanges.Row = Row
GrdPriceChanges.Col = 9
If CellPrice <> GrdPriceChanges.Value And CellPrice <> 0 Then
GrdPriceChanges.Col = 11
GrdPriceChanges.Value = 1
GrdPriceChanges.GetText 12, Row, VatRate
GrdPriceChanges.GetText 9, Row, SellPrice
GrdPriceChanges.GetText 8, Row, CostPrice
GrdPriceChanges.Col = 10
GrdPriceChanges.Value = CalculateMargin(Val(VatRate), Val(CostPrice), Val(SellPrice))
End If
ElseIf Col = 10 Then
GrdPriceChanges.Row = Row
GrdPriceChanges.Col = 10
If CellMargin <> GrdPriceChanges.Value And Val(CellMargin) <> 0 Then
Margin = GrdPriceChanges.Value
GrdPriceChanges.Col = 11
GrdPriceChanges.Value = 1
GrdPriceChanges.GetText 12, Row, VatRate
GrdPriceChanges.GetText 9, Row, SellPrice
GrdPriceChanges.GetText 8, Row, CostPrice
GrdPriceChanges.Col = 9
GrdPriceChanges.Value = SuggestPrice(Val(CostPrice), Val(Margin), Val(VatRate))
End If
End If
GrdPriceChanges.Col = 9
GrdPriceChanges.Row = NewRow
CellPrice = Val(GrdPriceChanges.Value)
GrdPriceChanges.Col = 10
GrdPriceChanges.Row = NewRow
CellMargin = GrdPriceChanges.Value
End Sub
To select a cell upon loading the form:
Private Sub Form_Load()
GrdPriceChanges.SetActiveCell 10, 1
End Sub
To select a column upon loading the form:
Private Sub Form_Load()
GrdPriceChanges.SetSelection 10, 0, 10, GrdPriceChanges.MaxRows
End Sub