VBA userform: modifying/deleting a selected row from a listbox

mrspz

New Member
Joined
Nov 9, 2017
Messages
37
Hi there,


I have a listbox which is displaying data from a table in my spreadsheet.


I'd like to be able to select a row and then select a command button to remove this row from the sheet (thus too removing it from the listbox).


In addition, I need to have the data in each collum, of the selected row displayed in textboxes which can be modified. When a textbox has been modified the user can click a command button and the data in the textboxes will be synchronised to the spreadsheet (thus also updating it on the listbox).


If any clarification is required, do let me know - I know this probably reads better myself.


Any help is appreciated! Thanks
 
Okay, so now there are no longer errors when adding or deleting. That all works perfectly now, but updating still results in the 1004 error.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It's always helpful when users know a little bit about reading code.

So you see here this line of code means when you click on a button name "UpdateRow"

The script will do what is in a button named "UpdateRow"
Code:
Private Sub UpdateRow_Click()
Are you sure your button is name "UpdateRow"

It must be exact.
Code:
Private Sub UpdateRow_Click()
 
Upvote 0
Yes, believe me I have checked this time and time again.

yUK7drd.png
 
Upvote 0
The only answer I have is it's obvious now since in our last test removing some lines of code made things work
Excel 2016 does not like to do things Excel 2013 can do

There have been similar complaints on this forum about Excel 2016.
Every time changes are made to Excel there are some issues.

So I really do not have a answer since I do not own 2016

I'm sorry we have had all these issues. And I have not been able to help you.
The delete and add row script are very simple. So I guess that's why they work. But they did not like doing the update

I really liked working on this but am sorry it did not work for you.
 
Upvote 0
****, that's a shame. Is there anywhere else you'd recommend trying to troubleshoot this at?

I'm glad you liked working on it - thank you for lending so much of your time to me, that's very honourable of you.

edit: when it comes to fixing the formatting of the textboxes, will that be an easy fix to do? I read some things online about a function called CDate?
 
Last edited:
Upvote 0
Yes there are ways to fix that but would need to know what type value goes in each Textbox.
Like is it a date
Or time

Not sure where to find help. Unless someone on this forum who is smarter then me. Which there are many of them here.

Maybe you could make a new posting here on this forum.

Show them just that line of code explain it works with Excel 2013 but not 2016 and maybe someone else can provide a answer.

If you get a answer that works let me know.


Hope you find a way.



****, that's a shame. Is there anywhere else you'd recommend trying to troubleshoot this at?

I'm glad you liked working on it - thank you for lending so much of your time to me, that's very honourable of you.

edit: when it comes to fixing the formatting of the textboxes, will that be an easy fix to do? I read some things online about a function called CDate?
 
Last edited:
Upvote 0
Sorry to see we have not found a way to get this working for you. Odd it works for me using Excel 2013. And other guy helping on other thread says it works for him using Excel 2016. But we can not get it to work for you.
I have written numerous scripts like this before and never had a problem.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

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