ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MSFlexGrid Delete Row (https://www.excelbanter.com/excel-programming/359803-msflexgrid-delete-row.html)

gti_jobert[_91_]

MSFlexGrid Delete Row
 

Hi all,

I have implemented an MSFlexGrid onto my form, I have a fixed row for
Header. I have a problem when deleting from the grid, see code below;


Code
-------------------

Private Sub ProductionGrid_DblClick()

Dim R$
Dim lCurRow As Long
lCurRow = ProductionGrid.Row

'delete row upon confirmation
MsgBox ProductionGrid.RowSel
If ProductionGrid.RowSel 0 Then
R = MsgBox("Are you sure you want to delete this line?", vbYesNo, "Confirm Delete")
If R = vbYes Then

If ProductionGrid.Rows = ProductionGrid.FixedRows + 1 Then
ProductionGrid.FixedRows = 0
End If
ProductionGrid.RemoveItem (lCurRow)
End If
End If
End Sub

-------------------


The code above is a modification to enable me to delete the last ro
without the error "unable to delete last non fixed row".

but now my header row is no longer fixed and I cant set it t
fixed....

Anyone else been having some trouble here? TI

--
gti_jober
-----------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...fo&userid=3063
View this thread: http://www.excelforum.com/showthread.php?threadid=53631



All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com