I am trying to adapt a search/edit/delete userform I found on this site. Unfortunatly I can't find it again.
I have 10 columns in a listbox that is populated from a search. This all works well.
What I want to do is format columns 5, 6, 7, & 9 to date format (dd/mmm/yyyy)
I have managed to get it to do a single column (5) but have been unable to change the others.
The code I am using is:
Code
With Sheets("R&D")
Set r = .Columns("A:C").Find(What:=res, LookAt:=xlWhole, LookIn:=xlValues, MatchCase:=False)
If Not r Is Nothing Then
ReDim a(1 To 10, 1 To 1): i = 1
faddress = r.Address: ReDim Preserve a(1 To 10, 1 To i)
For ii = 1 To 10
If ii = 5 Then 'THIS LINE
a(ii, i) = Format(.Cells(r.Row, ii), "dd/mmm/yyyy") 'THIS LINE
Else 'THIS LINE
a(ii, i) = .Cells(r.Row, ii).Value
End If 'THIS LINE
Next
Do
Set r = .Columns("A:C").FindNext(r)
If r.Address = faddress Then Exit Do
i = i + 1: ReDim Preserve a(1 To 10, 1 To i)
For ii = 1 To 10
If ii = 5 Then 'THIS LINE
a(ii, i) = Format(.Cells(r.Row, ii), "dd/mmm/yyyy") 'THIS LINE
Else 'THIS LINE
a(ii, i) = .Cells(r.Row, ii).Value
End If 'THIS LINE
Next
Loop Until r Is Nothing
Else
Display More
Can any one point me in the right direction?
Many thanks
Windy