Delete data in userforms

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
how do i delete my data in userforms?
ihave a combobox and few textbox.
once i select an item in my combobox in userforms and click on the delete button, my data will erase..how do i do that?
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,912
Office Version
  1. 365
Platform
  1. Windows
Erased from where?
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
explaination

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 delete the entry by clicking a button using combobox1 to select the row that I want to delete?

2) is to delete the data by selecting my item in combobox1
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,912
Office Version
  1. 365
Platform
  1. Windows
But where do you want to delete from?

A worksheet?

From the combobox? ie remove the item from the list
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103

ADVERTISEMENT

erase from the spreadsheet

erase from the spreadsheet...
meaning i will use my combobox in userform to control it...
once i select the item to be deleted in the spreadsheet using combobox in userform, i will click the delete button, then the item show in spreadsheet willbe deleted...

in my combobox, rowsource is link to my spread sheet...
please advise
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,912
Office Version
  1. 365
Platform
  1. Windows
Depending on how you've populated the combobox ie what range you've used you could try something like this.
Code:
Private Sub CommandButton1_Click()
    Rows(ComboBox1.ListIndex + 1).Delete
End Sub
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
cant work!

ok, let me explain further..
I have 4 columns in my spreadsheet. First column will be “date” (column A), second column will be “fruits” (column B), third column will be “amount” (column C) and the fourth column will be “total amount”.
Im using my userform to key in data. I group these under “fruitsA” (define/name). Now I want to know how to delete and edit my data.
In order to delete my data, I need to select the date thru combobox in a userform. Once I selected my data in the userform, my textbox 1,2,3 which contain fruits, amount and total amount will appear. What I want is, when I choose (for example: date 12 July 2006) and click the button delete. My spread sheet under column A that has the same date will be deleted together with the same row.

How do I do that?
Besides this, if I want to edit my data, once I click on combobox, my date will appear and all I want to do is, edit the figures maybe column C (from “20” to “30”) and save it to the spreadsheet my replacing the old date information.. I cant seems to do that too. I did something like tat, but it did not overwrite my old spread sheet… please advise as im new in userforms applications…
 

Watch MrExcel Video

Forum statistics

Threads
1,112,885
Messages
5,543,028
Members
410,583
Latest member
gazz57
Top