Userform help!!!

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
I have an userform, when I choose my item in combobox1 in userform, my texbox1 will return me a value, lets say “20. now I want to change it to 30 instead of 20. how do I edit it once I select my item in combobox1?
Besides this, how do I delete the entry by clicking a button using combobox1 to select the row that I want to delete?

Basically, I have 2 scenarios,
1) is to edit the data by selecting my item in combobox1
2) is to delete the data by selecting my item in combobox1
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

no response after more then one day ...
let's try something

how is your combobox1 populated ?

kind regards,
Erik
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
let me explain

i have 4 columns in one sheet
column A = date
Columb B = fruits
column c = quantity
column d = total amount
i have group these as "fruits1" using define/name

this is a database sheet...
im using a useform to control it..well everything was perfectly fine until when i need to edit or delete the data that i have previously entered.

first i need to have a button to delete the rows...so i used a combobox..and under rowsource =fruits1 (column A)
so now my combobox contained dates that i have entered previously. in order to delete, all i need to do is select the date that i wish to delete using combobo and click the delete button..my problem comes where i dont know the code for delete button(where i want it to delete the whole row including the date that i have selected).
nothing fancy..just a normal delete bbutton that deletes my row (the row with the date that i have selected using combobox )

is that possible? please advise....

and when i want to edit...all i need to do is click on the same combobox whcih contains date..from there i just key in a new figures..and click on abutton called "Save Edit". this will overwrite the info under the same row with my date (selected by my combo box)..

the most important is the delete button..please advise
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
OK
I presume once you know the row to work with, you will be able to edit your code, if not feel free to post more questions :)

this code will work if your combobox has a rowsource
(perhaps you want to name the range dynamically: then see http://www.datapigtechnologies.com/flashfiles/dynamicranges.html
If you are on Excel 2003, convert the data area into a list by means of Data|List|Create List.
Code:
Dim SR As Long          'Search Row

SR = Range(ComboBox1.RowSource)(1)(ComboBox1.ListIndex + 1).Row
Rows(SR).Select
edit to delete rows
if the correct row is selected, then replace "select" by "delete"

best regards,
Erik
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
erik...i dont know the code to edit and delete

Hi,
im sorry, im new in userforms...my real problemis to edit and delete the data...
currently i have inserted your code to my "delete button"(commandbutton). once i click delete, it will auto select the whole row of the selected cell. but how do i delete it...(code to delete the row)..

and when it comes to edit, i have 3 textbox..i have inserted your code to my "editbutton" (commandbutton). all i need to know is the code to edit..
well i guess once i click editbutton, excel will select the row,delete column 2,3,4 (leave the delete) and insert the new data im going to key in..
but how do u do all that?

is that tough?
sorry man, need advise on that 2 scenarios/..
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Re: erik...i dont know the code to edit and delete

Hi,
im sorry, im new in userforms...my real problemis to edit and delete the data...
currently i have inserted your code to my "delete button"(commandbutton). once i click delete, it will auto select the whole row of the selected cell. but how do i delete it...(code to delete the row)..

and when it comes to edit, i have 3 textbox..i have inserted your code to my "editbutton" (commandbutton). all i need to know is the code to edit..
well i guess once i click editbutton, excel will select the row,delete column 2,3,4 (leave the delete) and insert the new data im going to key in..
but how do u do all that?

is that tough?
sorry man, need advise on that 2 scenarios/..
you pust have been tired, since I told you how to edit to delete
edit to delete rows
if the correct row is selected, then replace "select" by "delete"

now that you know which row you are working with (the variable SR holds the rowvalue), you can use this to edit it
check what columns are your textboxes refering to and us this kinda code
Cells(SR, "A") = TextBox1
or
Range("A" & SR) = TextBox1

best regards,
Erik
 

Forum statistics

Threads
1,144,389
Messages
5,724,073
Members
422,534
Latest member
ThiccNugg

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
Top