Using a form to move cell contents

cmacedo

New Member
Joined
Jul 7, 2011
Messages
1
Hi All,

I've got a spreadsheet which has three columns. Backlog, In Progress, Done.

I also have a form for that spreadsheet which has three ListBoxes. Each of which corresponds to one of the columns.

Beside each listbox, are the buttons 'Up' and 'Down'.

I want to be able to select an item in the listbox, click one of the two buttons, and see the corresponding movement both in the listbox, and on the sheet of the selected cell contents.

However, I have no idea how to write the macro on the buttons to do this.

Help?

Christian.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
This shows the code for one of the listboxes (lbBacklog) and its Up and Down command buttons. I've assumed you have column headings in row 1 and the first data item starts in row 2. Put the code in the UserForm module.
Code:
Private Sub cmdUp_Click()
    If lbBacklog.ListIndex > 0 Then lbBacklog.ListIndex = lbBacklog.ListIndex - 1
End Sub

Private Sub cmdDown_Click()
    If lbBacklog.ListIndex < lbBacklog.ListCount - 1 Then lbBacklog.ListIndex = lbBacklog.ListIndex + 1
End Sub

Private Sub lbBacklog_Click()
    Cells(lbBacklog.ListIndex + 2, "A").Select      'Column A - Backlog
End Sub
The code for the other listboxes and command buttons should be similar, with the appropriate control names and column letters.
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,948
Latest member
UsmanAli786

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