Spinbutton and Listbox help

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi please can you help me, i have a Listbox1 where data is inoiutter from a userform, i have a spinbutton but i would like to toggle up and down the data in the listbox and if a row is highlighted to click on another arrow for this to then move the data over to sheet1. Can you help me please?
VBA Code:
Private Sub SpinButton1_Change()
    On Error Resume Next
    ListBox1.ListIndex = SpinButton1.Max - SpinButton1.Value
    
    ActiveSheet.Select '?
    ActiveSheet.Move After:=Sheets(ActiveSheet + 1) '?
    On Error GoTo 0
End Sub


Private Sub SpinUserForm_Initialize()
    Dim sh As Worksheet
    
    For Each sh In Worksheets
        ListBox1.AddItem ("Sheet1")
    Next sh
    
    With SpinButton1
        .Min = 1
        .Max = 50
        .Value = .Max
    End With
    
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top