Listbox - Delete Source
Feb 15, 2008
I have a listbox which brings up my bets for todays horseracing. If say one of my selections is a non-runner, would I be able to add a command button to delete that selection from the source data.
The source range is "AL10:AN24". So all I would want to do is select the selection if it isn't running and click on the command button to delete the selection.
I already have code to sort the source data and would like to add this code to the new code, so once a selection has been deleted the source is also resorted.
Here is that code, in case it is needed:
Private Sub CommandButton1_Click()
Range("SYSTEMS!AL10:AN24").Sort Key1:=Range("SYSTEMS!AL27:AO41"), Order1:=xlAscending
End Sub
View 9 Replies
ADVERTISEMENT
Oct 26, 2008
why this is causing an error upon opening the file. This workbook has a userform with a listbox (single list, single selection), and when I have the ControlSource property set it causes an error upon opening the userform (which opens when the file is opened), whereas if I do not have the ControlSource property set to anything, it seems to work fine.
Interestingly, if I set the file up to not open the userform with the file, and instead have the userform open when a worksheet control such as a command button is clicked, it doesn't seem to matter if the ControlSource property is set or not. The workbook in question is attached.
View 14 Replies
View Related
Aug 17, 2007
I have two worksheets that directly link a range of cells on both sheets, ie: Output!a1 = Database!a1.
In this case, the Database sheet contains data that I want to manipulate by deleting entries that are defined in rows. however, when I delete one of the source rows I get a #REF error on the Output sheet.
Is there any way to avoid this so the entries will automatically shift down a row if a row has been deleted? :o
So if i were to delete row two on the source page and the data from row three moves down, that would, in turn, cause the row three data on the output page to move down one row as well.
View 9 Replies
View Related
Sep 19, 2012
i have code like this to copy certain word in cell and place it at new sheet:
VB:
Sub Foo()Dim i As Long, iMatches As Long
Dim aTokens() As String: aTokens = Split("Accommodation", ",")
For Each cell In Sheets("Sheet1").Range("C:C")
[Code].....
the problem is the cell source is not deleted. what line should i change in code above to move the result to new sheet and delete row source
View 7 Replies
View Related
Apr 29, 2008
My worksheet has a report name in cell A1, a brand name in B2, price name in C2, and color in D2. Row 3 has a table header in cell range A3:E3 followed by rows of table contents at the end of which is a row of empty cells. This sequence repeats itself for a new product: a row with the report name in column A, followed by a row with a new brand name, price and color in the same columns as before followed by the same table header and table contents. The number of products (with the previously mentioned details and table) vary so I would like to write a macro that is not dependent on a set number of products. Each table varies in the number of rows but never contains empty cells and always ends with a row of empty cells. I want to delete all rows with the report name and have all products in one table with the brand, price and color added to the table header and contents.
View 2 Replies
View Related
Nov 18, 2005
I have a listbox in my user form and it has a Rowsource of A1:A225, I need to be able to select a value in the list box and hit Command_Button4 to delete it.
Private Sub CommandButton4_Click()
DeleteName
End Sub
Sub DeleteName()
ListBox1.Value.Select
Selection.ClearContents
End Sub
Also, is there anyway to ignore blank cells in the listbox?
View 5 Replies
View Related
Oct 16, 2007
My userform has an update button that displays a listbox in a userform. The user selects from the list, chooses to update and another userform appears to request some additional information before saving it to a different sheet. This works fine, but how do I then delete the row containing the original item on the original sheet selected from the listbox at the same time?
View 2 Replies
View Related
Mar 19, 2008
I have two buttons with macros attached. One button inserts a new wave line and everytime a wave is inserted, the number of that wave follows on. I have another button which inserts a new store line. There can be multiple stores per wave. What I want now is another button which when clicked would bring up a listbox of all the waves so that I could select a wave to delete. Once I deleted a wave I want the waves which are left to re number themselves so that they aren't out of order. This would have to also delete each store which was underneath that particular wave.
View 8 Replies
View Related
Feb 3, 2007
I wunder if it is in any way possible to delete an item if you drag it outside the boundries of the listbox
View 2 Replies
View Related
Jul 22, 2014
Here I have a listbox, but I would like to know if it's possible to be able to sort each header on the userform when clicking on the header?
Also, how should I also delete some entries with a button?
listbox.xlsm
View 14 Replies
View Related
Apr 7, 2009
I have a list box that shows a range of cells (called emailrange). I want to add a Delete button that enables a selected value in the Listbox to be deleted if necessary (just the cell value not the row).
The code I have thus far is below: ...
View 10 Replies
View Related
Jun 7, 2012
I have two listboxes where I can move tickers from left to right. This is synced with a sheet, such that the tickers also are pasted there too.
But if I use the remove button, I can remove tickers from the listbox, but I cannet delete them from the sheet. If I understand right the listbox only refer to what row the selected is, not what the text is...
And then its a bit tricky. I have tried a code where it just add the list one more time, after the itmes has been removed. And that could work if it hadn't been for the second column which also has a text, this column is updated after every ticker has been moved from left to right.
What I would like to have is a function that would know what the text in the row that I delete, or remove.
This is what I have so far:
Code:
Private Sub cmdMoveToLeft_Click()
Dim i As Integer, j As Integer, k As Integer
Dim RowsStart As Integer
Dim LastRow As Long
Dim Rows As Integer
RowsStart = Me.ListBoxX.ListCount
[Code] .......
View 4 Replies
View Related
Apr 24, 2007
what is the vba code to delete the rows that the data you select from a list box. also how do you multiple select the data. the code i used is this
Sub RemoveDuplicate() Dim AllCells As Range, Cell As Range Dim NoDupes As New Collection Dim i As Integer, j As Integer
Dim Swap1, Swap2, Item
' The items are in A1:A105 Set AllCells = Range("p21105")
' The next statement ignores the error caused
' by attempting to add a duplicate key to the collection.
On Error Resume Next For Each Cell In AllCells NoDupes.Add Cell.Value, CStr(Cell.Value) Note: the 2nd argument (key) for the Add method must be a string Next Cell................
View 4 Replies
View Related
Apr 1, 2009
Not sure if this can be done, still a rookie at this stuff. Everything works but can something be wrote into code too change list source?
View 5 Replies
View Related
Sep 7, 2006
I have a report that was created for 2005 that contains two worksheets: a "source data" worksheet and a " pivot table" worksheet. I cleared out the 2005 data in the "source data" worksheet and replaced it with 2006 data...after this I refreshed the Pivot Table and everything seemed fine. When looking at the file size I noticed that it was almost twice its original size....upon further investigation I found that the Pivot Table was internally holding onto the old source data (the "Show" functionality of the rows/columns in the table lists the 2005 row/column headers as well as the 2006 headers....even though no data from 2005 is shown in the Pivot Table).
Does anyone know how to purge the old data from the internal Pivot Table memory?
I hope this is enough information....let me know if you need more.
Thanks in advance for any help,
Jon
View 9 Replies
View Related
May 1, 2014
I have two lists mainly TV Brand & There Models.
List 1 (TV Brand)
Sony
LG
Samsung
Depended List 2 (Models)
Sony LG Samsung
EX420 55EB9600 PL43E450A1FXZP
EX430 77EC9800 PL43E490B4FXZP
EX550 55EA8800 PL43E400U1FXZP
EX520 KN55S9C UN32EH5300FXZP
EX645 55EA9800 PL64E8000GFXZP
I'm using two Listboxes (Form Control) with multiple selection options namely Listbox 1 (Brand) & Listbox 2 (Models). I want listbox 2 input range to be depended on selection made on Listbox 1 (Brand). For example, if user selects Sony then box2 should show only Sony's models and if user selects Sony & LG, box2 should show models for both Sony & LG.
View 3 Replies
View Related
May 27, 2014
I have a userform where I can select multiple items in a listbox and add them to another. I also have the ability to filter the first listbox to make finding items easier. The issue I am having concerns the clear filter button. As currently designed, the clear filter button will reset the initial listbox back to its default values. Ideally, I would like it to reset to the default values excluding those values that currently in the second listbox.
The entire code is below for reference, but it's the sub ClearFilter_Click that I am struggling with.
[Code] ....
View 2 Replies
View Related
Apr 4, 2014
im trying to create a two column listbox that will transfer both columns to the listbox on the right and also transfer from the right to left currently right to left works but when I trasnfer from the left to right then the right to left only one column is moved.
View 4 Replies
View Related
Mar 31, 2007
I have two sheets and two listbox's(ColumnCount8) and one command button.
lstInYard rowsource is set to sheet1
lstMilled rowsorce is set to sheet3
Iam trying to cut and paste the selections in lstInYard to lstMilled as well as the corrosponding row values in sheet1 to sheet3 by using cmdMoveSelected click event.
View 9 Replies
View Related
Dec 6, 2006
I have one source spreadsheet, where are columns NAME, DATE. I read these data by ADO to other spreadsheet, where I can change/delete data and then run macro for update data in source spreadsheet. The problem: In source spreadsheet is column "NAME" and column "DATE", with values e.g. "Joseph"; 1.1.1980. I read this data to other spreadsheet, then I delete in it value 1.1.1980. When I run macro Update, it messages error.
Sub UpdateItem
...
.Fields.Item(1).value = activecell 'activecell value = "Joseph"
If Not isempty(activecell.offset(0,1)) Then
.Fields.Item(2).value = activecell.offset(0,1).value
Else
.Fields.Item(2).value = "" 'I tried Empty and 0 too but when I read data again then, it displays 0.1.1900, nothing works
End If
...
End Sub
It seems that in source spreadsheet has data in column "Date" format Date and when I try to update data in format String ("") in source spreadsheet by Update macro, it messages error. When I used
.Fields.Item(2).Value = Empty
' or
.Fields.Item(2).Value = 0
after rereading data it displays 0.1.1900 What I want to get is that if the cell with date (in other spreadsheet) is empty, the cell in column Date in source spreadsheet after updating will be blank (contains no values).
View 2 Replies
View Related
Mar 18, 2014
I have 2 userforms. UF1 and UF2. UF2 has a rowsource set to its Listbox. UF1 has a search function that searches the original sheet. Now I want to double click on an entry in UF1's Listbox and select the same entry in UF2's Listbox. I want to then work with that entry in UF2.
[Code].....
I do all of this to circumvent Excels restriction. I can't search in a rowsource Listbox, but any edits done to my new Listbox wouldn't be made to the Excel sheet.
View 6 Replies
View Related
Sep 27, 2007
I have the following sheet which functions as a table to store values for files that have been created using the application which this table is in. In this app., I have a form with 2 listboxes. When the form loads, I have the first listbox list values which each of these files are listed under (i.e. - "sub-directories"). With a selection of one of the list values and clicking of a button, I want the second list box to list the values of cells listed in a range directly below where the selected value in the first listbox came from.
I'd prefer, in the first listbox, to have only the values of the ranges that have a value in them in the listbox. However, this would cause my listbox.selected(array) not function properly. But since my current offsets (in the second sub) do not seem to be working anyway, maybe I am going about this totally wrong.
View 9 Replies
View Related
Apr 8, 2007
The following line highlights the first selection in the listbox visible and calls the listbox click event
myListbox.Selected(0) = True
myVal = myListbox.Value 'after this line executes, instead of being set to the actual first value in myListbox, myVal is ""
Why is myVal not set to the first selection in the listbox? After I execute the following code, myListbox.Value still equals "" and not "Counter 1".
myListbox.Value = "Counter 1"
Why can I not set myListbox.Value?
View 8 Replies
View Related
Jun 28, 2007
I have 1 listbox (lisbox1) that retrieve it's list items from a worksheet range (imported/database query from access). This works fine.
I have a second listbox (listbox2) that should display results from clicking a value in listbox1.
Listbox1 contains companynames (1 column), listbox2 needs to be populated with quotes.
Range A3:D4800 contains company ID's, Company names, Quote Numbers. When I select a company name in listbox1, I need listbox2 to be populated with all quotes for that company.
I have tried (using vba) to do a vlookup using the listbox1 value, but I cannot seem to figure out how to populate listbox2 with "all" quotes. I get 1 quote and that's it. I realize I probably need to have the vlookup loop through each cell in the range to find the value, but when I try this, I get a type mismatch when using the .additem (only for the 2nd and subsequent passes).
View 9 Replies
View Related
Dec 7, 2007
I cannot find this information anywhere else in this forum...
Does anybody know how to transfer an item from one list box to another using code, on the click of a button.
The list box with the information in is called 'Team_ListBox'The list box i am wanting to transfer to is called 'Starting_Team_ListBox'The button to do this task is called 'AddPlayer_team_Btn'
View 3 Replies
View Related
Apr 18, 2006
I have two listboxes on a userform. One is the "choice" listbox, the other is the "master" listbox. Each item selected is a billing object on a sales invoice.
problem: The master list works fine when the item is selected in the choice list. But when it is deselected, how can you REMOVE it from the master list? question: How can I add a text box automatically to the userform to allow the user to enter quantity info?
For I = 0 To CodeList.ListCount - 1
If CodeList.Selected(I) = True Then
obj = CodeList.Column(0, I)
p = 6
test = 0
Do While test = 0 And p <= 25
If sheetsales. Range("C" & p) = obj Then
test = 1
Else
test = 0
End If
p = p + 1
Loop
If test = 0 Then.........................
View 2 Replies
View Related
Apr 28, 2008
Below is my code. I need the row source for my combobox to be dynamic. I created a named formula and referenced the formula in my code. It doesn't work.
This is the formula "listname"
=OFFSET(MyList!$C$2,0,0,COUNTA(MyList!$C:$C)-1,1)
Private Sub ComboBox1_Change()
ComboBox1.RowSource = Range("ListName")
End Sub
View 9 Replies
View Related
Mar 17, 2014
Is there any way to directly go to a formula? Instead of searching it through all the sheets? For example, if I have a formula =SUM(Sheet1!A1:A5) is there any way for me to automatically go to the source?
View 7 Replies
View Related
Jan 19, 2008
I would like to retrieve contents of a web page, be it HTML or XML, into VBA variable!
Later, I would chop, cut, parse or extract the data I need.
Both importing as XML or WebQueries is unsatisfactory for a certain number of pages I need. XML has bad schema, WebQuery tells me it can't find any data.
I tried with WinHTTPRequest, but Excel gives me back error "undefined user type" in other words it doesn't recognize that object.
Basically I want the source of web page to become a string in my VBA code. In other words that would be replication of funcionallity of
View 15 Replies
View Related
Oct 29, 2009
The problem is, these identifiers are in no discernable or predictable pattern. I cannot open the page directly in excel, nor can I use the Import Data from Web function (2007) ... results are simply a blank page.
What I thought I could do, then, is automate the procedure that obtains the source code, which I can parse and look for the current date. Once I have the line with the current date, I can extract the unique identifier, then paste it back into a string and resubmit to the browser.
I just can't figure out how to get to the source code... anybody out there have a way to get to it? Since this is going to ultimately be distributed to 20 or so analysts in different countries, I don't think I can use other tools (like the HTML Extractor from Iconico).
View 2 Replies
View Related