ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Okay, Let's ask this another way (https://www.excelbanter.com/excel-programming/307153-re-okay-lets-ask-another-way.html)

Bob Phillips[_6_]

Okay, Let's ask this another way
 
Hee's a couple of routines

Dim vTemp, vtemp1

With ListBox1
If .ListIndex 0 Then
vTemp = .Value
vtemp1 = .List(.ListIndex, 2)
.List(.ListIndex) = .List(.ListIndex - 1)
.List(.ListIndex, 2) = .List(.ListIndex - 1, 2)
.List(.ListIndex - 1) = vTemp
.List(.ListIndex - 1, 2) = vtemp1
.ListIndex = .ListIndex - 1
End If
End With
End Sub

Dim vTemp, vtemp1

With ListBox1
If .ListIndex < .ListCount - 1 Then
vTemp = .Value
vtemp1 = .List(.ListIndex, 2)
.List(.ListIndex) = .List(.ListIndex + 1)
.List(.ListIndex + 1) = vTemp
.List(.ListIndex + 1, 2) = vtemp1
.ListIndex = .ListIndex + 1
End If
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"asmenut" wrote in message
...
Is there a way to use a multi-column list box to reorder rows of data

(i.e.
move up / move down)?




asmenut

Okay, Let's ask this another way
 
Thanks

"Bob Phillips" wrote:

Hee's a couple of routines

Dim vTemp, vtemp1

With ListBox1
If .ListIndex 0 Then
vTemp = .Value
vtemp1 = .List(.ListIndex, 2)
.List(.ListIndex) = .List(.ListIndex - 1)
.List(.ListIndex, 2) = .List(.ListIndex - 1, 2)
.List(.ListIndex - 1) = vTemp
.List(.ListIndex - 1, 2) = vtemp1
.ListIndex = .ListIndex - 1
End If
End With
End Sub

Dim vTemp, vtemp1

With ListBox1
If .ListIndex < .ListCount - 1 Then
vTemp = .Value
vtemp1 = .List(.ListIndex, 2)
.List(.ListIndex) = .List(.ListIndex + 1)
.List(.ListIndex + 1) = vTemp
.List(.ListIndex + 1, 2) = vtemp1
.ListIndex = .ListIndex + 1
End If
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"asmenut" wrote in message
...
Is there a way to use a multi-column list box to reorder rows of data

(i.e.
move up / move down)?






All times are GMT +1. The time now is 12:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com