Hi
I am developing an Excel userform that has a multi-columnlistbox. I intend to use this to display data from a worksheet, make some changesto it, write it back to the worksheet, and refresh the listbox. It’s alist of payments, and the idea is that I can change, say, the amount for apayee, or a payee name etc. Ultimately, I’ll want to add or delete payments,which means that the named range would need to be able to reduce or extend.Initially, though, I just want to get the edit working.
I've been able to successfully populate the listbox from anamed range, using the following code:
With lstPayments
.ColumnCount = 6
.ColumnWidths = "110;80;35;35;60;35"
.RowSource = Sheets(curBudgetMonth).Range("Payments").Address
End With
I’ve also written some code that enables me to identifywhich payment will be changed, from the selected row in the listbox. However, i'mnow kinda stuck trying to figure out the ideal approach to editing and writingback the changes, making sure i’m targetting the right row in the named range.I thought about using an excel table as my source, instead of a named range, thinking Itwould be easier to use table references to write the data back. However, aftermuch trawling through excel forums, I couldn’t find a way to populate thelistbox from an Excel table, so I’m still thinking it will be a named range.
I’m still a bit of a novice at Excel VBA, and part of doingthis little project was so I could learn more, so any help would be muchappreciated!
I am developing an Excel userform that has a multi-columnlistbox. I intend to use this to display data from a worksheet, make some changesto it, write it back to the worksheet, and refresh the listbox. It’s alist of payments, and the idea is that I can change, say, the amount for apayee, or a payee name etc. Ultimately, I’ll want to add or delete payments,which means that the named range would need to be able to reduce or extend.Initially, though, I just want to get the edit working.
I've been able to successfully populate the listbox from anamed range, using the following code:
With lstPayments
.ColumnCount = 6
.ColumnWidths = "110;80;35;35;60;35"
.RowSource = Sheets(curBudgetMonth).Range("Payments").Address
End With
I’ve also written some code that enables me to identifywhich payment will be changed, from the selected row in the listbox. However, i'mnow kinda stuck trying to figure out the ideal approach to editing and writingback the changes, making sure i’m targetting the right row in the named range.I thought about using an excel table as my source, instead of a named range, thinking Itwould be easier to use table references to write the data back. However, aftermuch trawling through excel forums, I couldn’t find a way to populate thelistbox from an Excel table, so I’m still thinking it will be a named range.
I’m still a bit of a novice at Excel VBA, and part of doingthis little project was so I could learn more, so any help would be muchappreciated!