kinetekerz
Board Regular
- Joined
- Jun 11, 2015
- Messages
- 53
Hi all!
I have the following code which MickG has helped me with on this forum.
I am looking to adapt it to as well as being able to pull selected data from the sheet, i am looking at being able to select the line from the listbox, to delete the associated row in the sheet?
Im quite new to this and unsure how to change the code for this feature to be implemented?
If this cant work, is there a workaround?
I have the following code which MickG has helped me with on this forum.
Code:
Dim Rng As Range, Dn As Range, p As Variant, c As Long, Ac As IntegerWith Sheets("Candidates")
Set Rng = .Range(.Range("I1"), .Range("I" & Rows.Count).End(xlUp))
End With
ReDim ray(1 To Rng.Count, 1 To 5) 'Extra column added (4 to 5)
For Each Dn In Rng
If Dn.Value = TextBox1.Value Then
c = c + 1: Ac = 0
For Each p In Array(-6, -5, -1, 0, 5) '(5) added, for column "N" which is 5 columns offset from "I"
Ac = Ac + 1
ray(c, Ac) = Dn.Offset(, p).Value
Next p
End If
Next Dn
With ListBox1
.Clear
.ColumnCount = 5 'Column added
.ColumnWidths = "50,50,60,75,50" 'Column added
.List = ray
End With
I am looking to adapt it to as well as being able to pull selected data from the sheet, i am looking at being able to select the line from the listbox, to delete the associated row in the sheet?
Im quite new to this and unsure how to change the code for this feature to be implemented?
If this cant work, is there a workaround?