Being new to VB I have aquired a Listfill code that deletes a the Players Row when selected from the list.
I'd like to use the same code, only this time modify 3 cells on the selected Players row.
The code I have is:-
What I need is for it to be modified to find the selected Players row, then select and modify the following 3 cells along that row, as below.
I can modify the messages later.
Any help appreciated.
I'd like to use the same code, only this time modify 3 cells on the selected Players row.
The code I have is:-
Code:
With ListBox1
If .ListIndex = -1 Then
MsgBox "You did not select anyone in the list ?", 48, "Cannot continue."
Exit Sub
End If
Dim i&, xRow&, strSelected$
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
xRow = i + 1
Exit For
End If
Application.ScreenUpdating = False
Next i
strSelected = .List(.ListIndex)
'A little safer using Find than xRow = i
xRow = Sheets(1).Columns(2).Find(What:=strSelected, LookIn:=xlFormulas, LookAt:=xlWhole).Row
Dim myConf%
myConf = MsgBox("You selected:- " & strSelected & vbCrLf & vbCrLf _
& "Are you sure want to delete this Player?", 36, "Please confirm")
If myConf = 7 Then
MsgBox "No problem, nothing will be deleted.", 64, "You clicked No."
Exit Sub
End If
End With
Application.ScreenUpdating = False
With Sheets(1)
.Rows(xRow).Delete
ListBox1.Clear
ListBox1.List = .Range("B10").Resize(.Range("B10").CurrentRegion.Rows.Count, 1).Value
End With
Range("D6").Select
Application.ScreenUpdating = True
Unload Me
MsgBox "Player has been deleted.", 64, "Done"
What I need is for it to be modified to find the selected Players row, then select and modify the following 3 cells along that row, as below.
Code:
' Selected Row @ Column "J)
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Selection.Font.ColorIndex = 3
Selection.Interior.ColorIndex = 6
Selection.Interior.Pattern = xlSolid
' Selected Row @ Column "S"
ActiveCell.FormulaR1C1 = _
"=IF(J10>=50,4,IF(J10>=45,3,IF(J10>=40,2,IF(J10>=38,1,IF(J10<=37,0)))))"
' Selected Row @ Column "T"
ActiveCell.FormulaR1C1 = _
"=IF(F10<10,1,IF(S10=1,2,1))"
I can modify the messages later.
Any help appreciated.