Thread: Textbox problem
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Textbox problem

I tested this and it works:

Private Sub CommandButton1_Click()
Dim i As Long
Dim j As Long
Dim tmp As String
Dim fSorted As Boolean
Dim sStr as String, sStr1 as String
Dim dti as Date, dtj as Date

For i = 1 To 5
For j = i + 1 To 6
sStr = Me.Controls("Textbox" & i)
sStr1 = Me.Controls("Textbox" & j)
If IsDate(sStr) Then
dti = CDate(sStr)
Else
dti = Date + 5000
End If
If IsDate(sStr1) Then
dtj = CDate(sStr1)
Else
dtj = Date + 5000
End If
If dti dtj Then
Me.Controls("TextBox" & i).Text = _
Me.Controls("TextBox" & j).Text
Me.Controls("TextBox" & j).Text = sStr
End If
Next j
Next i

End Sub

--
Regards,
Tom Ogilvy

"Robert Couchman" wrote in message
...
Desaster strikes!!!!

Bob, im afraid even though you have updated that piece of
code, it still seems to do the same thing!!

i will try .value instead of .text, but i cant see it
working!!

sorry!!

the cheque will bounce now! :)

Robert Couchman
)