that only seems to highlight one cell. also i think i definetly need the selctionmode to be free.
This is the code i have which is called from the procedures to add mouse down and some other buttons which do stuff!
The problem with this is that it doesnt always seem to work, mbpreviousselected row is a variable that is set each time the code behind these procedures are run, i really dont like it as i think this is where the problem is, so looking to find a solution to replace it.
Sub subChangecolours(IntColourSelection As Integer, Optional IntRowRef As Integer)
Dim IntCnt As Integer ' Integer counter for looping through.
Dim intNewRow As Integer
Dim intNewCol As Integer
Dim intThisRow As Integer
'Changes colours of rows in MSflexGrid control
'******************
'Set Colour white & Blue
Select Case IntColourSelection
Case 1 ' add
If mPrevSelectRow > 0 And grdTimesheet.Rows - 1 >= mPrevSelectRow Then
grdTimesheet.Row = mPrevSelectRow
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = vbWhite
Next IntCnt
End If
With grdTimesheet
.Rows = grdTimesheet.Rows + 1
.SetFocus
.Row = grdTimesheet.Rows - 1
.Col = 1
End With
lstFlag.List(grdTimesheet.Row - 2) = "Blank" & _
Str(grdTimesheet.Row - 2) 'add a line to maintain array size
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = &HFFFFC0
Next IntCnt
Case 2
'SPARE WAS DELETE BUT SURPLUS
Case 3 'Selected row (via Mouse down)
If grdTimesheet.Rows > mPrevSelectRow And mPrevSelectRow > 0 Then
grdTimesheet.Row = mPrevSelectRow
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = vbWhite
Next IntCnt
End If
intThisRow = IntRowRef
If intThisRow > 1 Then
grdTimesheet.Row = intThisRow
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = &HFFFFC0
Next IntCnt
End If
Case 4 ' New Instruction, Task,Client
If mPrevSelectRow > 0 Then
grdTimesheet.Row = mPrevSelectRow
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = vbWhite
Next IntCnt
End If
For IntCnt = 0 To grdTimesheet.Cols - 1
grdTimesheet.Col = IntCnt
grdTimesheet.CellBackColor = &HFFFFC0
Next IntCnt
mPrevSelectRow = grdTimesheet.Row
End Select
End Sub
Filmmaker, gentlemen and East end club promoter