Sort Macro Reverses When Anything Changed / Added To List
May 13, 2013
I used the "record macro" to record a simple sorting (high to low) of columns A-F based on values (0-3) in column A. Everything works when I initially institute the macro. However, when I change anything or add a new item at the end of the list, the order reverses and sorting goes from lowest to highest.?
Here is what ended up in the macro:
Code:
Sub SortColumnA()
' SortColumnA Macro
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
[Code]....
I noticed that it only includes a fixed value for the length of the list (row 90). Is there a way to have it increase when anything new is added?
As of now I plan on just making an arbitrary large index (~200 ish) to automatically grab anything new.
View 1 Replies
ADVERTISEMENT
Jul 23, 2007
I am using INDIRECT to create a second dynamic drop down list (L1) that is based on the cell contents of a first drop down list (I1). I want to create a macro that will blank the 2nd drop down list ONLY when the choice in the first list is CHANGED. I have the following, but it blanks the second list as soon as the first list is clicked on, rather than when a change is made:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Intersect(Range("I1"), Target) Is Nothing Then Range("L1").ClearContents
End Sub
View 2 Replies
View Related
Apr 29, 2009
From the sample file, I am using the data on (start) worksheet. (Sort and format sheet) . This one is way over my head. After new data is added to the sheet via another UserForm, I want to sort the list by name and have alternating backgrounds based on grouped unique names.
View 2 Replies
View Related
Jan 20, 2010
My problem this time is in regards to auto sorting a table as data is changed in another worksheet and is auto copied within the said table.
I.E. I need the Fax page (second last), the table has to auto sort based on column " C ". This is easily done using custom sort but can it be done automatically ? I want to lock the page so nobody modifies it.
I attached a copy of my work so far, using Excel 2007.
All the sheets are locked except " Player DATA " and " Fax ".
The password is " Moose ".
View 7 Replies
View Related
Aug 3, 2009
I have following code, which sorts data if user "double clicks" on cells A1, B1, C1, or D1. If the user "double clicks" on cell D1, I want to sort by column D but I want to apply a custom list. The data is in the "Custom Lists" table but I can't figure out how to apply to my code.
The sequence/sort order of the list is as follows:
aaa+, aaa, aaa-, aa+, aa, aa-, a+, a, a-, bbb+, bbb, bbb-, bb+, bb, bb-, b+, b, b-, ccc+, ccc, ccc-, cc+, cc, cc-, c+, c, c-, ddd+, ddd, ddd-, dd+, dd, dd-, d+, d, d-
code is as follows:
View 3 Replies
View Related
Nov 25, 2013
I'm having a problem with importing CSV files into Excel. My CSVs contain dates formatted Canadian style, dd/mm/yyyy. However, when some users open these files, Excel interprets the date as mm/dd/yyyy. (So the text string "01/09/2013", which should mean Sep 1 2013, becomes Jan 9 2013. The string "16/09/13" isn't recognized by Excel as a date at all.)
The annoying thing is that only some users have this problem. I've checked their Region and Language settings in the Control Panel and they're correctly set to English (Canada). I've also gone over their Excel preferences and couldn't find anything that seemed different from mine (or anything related to date formats at all, really).
I can work around by using the Import From Text option in the Data menu, but the users involved aren't techies and they need to open CSVs fairly often, so I'd prefer to streamline the process.
View 1 Replies
View Related
Nov 16, 2008
I have a list of letting agents that I need to sort into a table to import into Access. The list is dynamic in that not all the fields are present for every record. I will have over 4000 records to sort out, so I would really like to automate this. If possible the macro should read rows from the data worksheet and write to columns and rows on the Table worksheet. I have attached a small example of the data and output required. To make it a little more challenging the column header name is part of the data and will need stripping out as well.
View 3 Replies
View Related
Jan 28, 2007
I am trying to write a macro that will sort 2 columns of real numbers in ascending order, then merge them in ascending order into a new 3rd column.
View 9 Replies
View Related
Dec 21, 2009
I have two lists of components, a component from List A is added to one from List B and a total in £'s needs to be shown, simple enough I hear you say HOWEVER the LENGTH of component B is variable.
For example
Input part # ABC in A1 and £50 is shown as a total in D1, then input part # 123 in B1 and the length of 100 in C1 and the total changes to £100. Then if you change the figure to 200 the total changes to £150
View 7 Replies
View Related
Jun 27, 2013
We have created a macro that basically looks for rows that contain an "H" and hides the row if it does.
Users can add new rows throughtout the year to this spreadsheet. and based on certain criteria, an H or U will be placed in a hidden column which the macro looks at and hides any row it finds an H.
The user has to click on the button that has the macro assigned to it once they have finished working on the spreadsheet.
The problem we're finding is that for users who insert/delete rows, once they click the button it takes up to 15 seconds to run through macro (which is ok). However, users who haven't added or deleted any rows and who click the button, they have to wait upto 5 minutes (which isn't ok) for the macro ro run.
We can't figure out why the macro takes longer to run when no changes have been made?
View 8 Replies
View Related
Oct 3, 2009
I'm making a spreadsheet where I want the user to select an item in A1 from a List made using Data Validation. When the person makes the selection in A1 I want the next 5 columns to automatically display specific attributes that belong to A1. However, I'd like the user to then be able to change each of these items (in B1-F1) from their own individual Validation Lists. I'm using this to mix and match mythical monsters. So in A1 I have well known monsters like Jaws, Godzilla and the Lochness Monster. When you select one of these creatures, that creature's specific attributes show up in the next 5 columns -- things like Appearance, Motive, MO, Hideout, and Special Features. I then want to be able to change Appearance, Motive, MO, Hideout, and Special Features individually from their own Validation List. I basically just want to mix and match between the various creatures.
I've gotten it only partially working by doing the following: At the bottom of the page (for simplicity, I have everything in 1 sheet but I intend to move the "data" table for the Lists to their own sheet) I have a table where in the row for each creature I have the different attributes. A1 (my "creature name") was made using Data Validation from the A column. For the next column I made a Data Validation List for the items. Once that pulldown was made, I then went to the B1 cell and used VLOOKUP to autofill the cell when the person makes their "A1" selection. I repeated this for cells C1-F1. This works ok the first time you make a selection. But whenever you change the "default" value for B2 using the validation drop down list, the Vlookup formula is replaced by the actual text value. This results in the cell not changing when the person next changes the A1 value.
View 3 Replies
View Related
Mar 11, 2014
I have a cell that has a validation list. When i select a value from the list, i want the value of another cell to change automatically but it isnt working. The list source is pointing to another sheet:
=INDIRECT("DB_DAT!$J$268:$J$275")
I get an error when it tries to change the cell value. Its error no. 1004.
View 3 Replies
View Related
Mar 13, 2013
Is there a way to automatically create list of the Tab names, and have it automatically update when new tabs are added?
View 2 Replies
View Related
Jan 20, 2008
I have been working on large project using Excel VBA for several days. My code seems to be working correctly, but I have more to do and now, when I drag an object from the toolbox onto a UserForm, the object is not added to the list of objects on the form. If I go back to versions of the project that I was working on several days ago, there is no problem. If I run "Workbook Rebuilder", the objects that I have dragged onto the form are then added to the object list, but I still can't add new objects to forms from within the VBA editor. Is the project corrupted, or is there some other explanation, and are there any fixes? The code runs about 50 pages, and there are over 20 forms, so redoing from scratch is only a last resort option.
View 3 Replies
View Related
Mar 18, 2008
how to make all cells displaying an item from the list source update with new information added to list source.
Example:
Cell "A1" on worksheet 2 displays the 3rd slot of information from list source on worsheet 5. I want cell "A1" on worksheet 2 to update when the list source information in the 3rd slot on worksheet 5 is changed.
Notes:
The list is set up by naming the columns on Worksheet 5 and is set as a validation list on the other worksheets. So on Worksheet 2 column "A" has the validation
VB:
AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".
List=(Coulumn A 's name on worksheet 5)
View 9 Replies
View Related
Apr 12, 2013
I have a workbook that has two worksheets. One worksheet is an input worksheet. A user will select a date from a drop-down list and type in the events that occurred on that date in 8 adjacent cells. The user selects a button that advances date and clears form. On sheet 2, whatever was typed into sheet one is saved via VLOOKUP formula. However, if I try to change something retroactively and select a previous date from the drop-down list, it clears everything in sheet 2 that was typed for any selected day.
View 1 Replies
View Related
Aug 9, 2014
provide some code which lists all today changed Excel files on the C drive and hyperlink them.
View 3 Replies
View Related
Oct 28, 2009
I use Excel 2003. With a LOT of help from this board, I've written some macros for a workbook template that will be opened then saved with another name with an .xls extension. The problem is that the macros transfer data to and from another workbook template. Here's the code that's giving me problems.
Windows("BookA.xlt").Activate
Sheets("Sheet1").Select
ActiveWorkbook.Save
Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("BookB.xlt").Activate
How can I use the macro if I open BookA.xlt then change the name to BookZ.xls for my data entries? At the same time BookZ is open, I may use another instance of BookA.xlt and save that one as BookY.xls. What's the most feasible way to still use the macros?
View 9 Replies
View Related
Jun 5, 2014
Does excel 2013 have a fence way to sort a list of alpha numeric numbers and alphabetize in this order A - Z and then 0 - 9.
Ex) Apple, Greg, Rob, Sand, 123, 126, 1000, 2001
View 2 Replies
View Related
Jun 25, 2014
The following code works fine but now I want it to work without a userform. SO there is no userform and so no controls.
When the user changes date in a cell then a macro should run and following kind of code should execute.
[Code] .......
View 3 Replies
View Related
May 21, 2008
how to alter this Private Sub for my code to execute automatically once all 3 cells have changed. At the moment it executes as soon as any of the 3 cells change.
Here's the Private and Public Sub codes:
View 9 Replies
View Related
May 1, 2009
I'm making a worksheet with 64 dropdown boxes.
I would love a macro that activates whenever any combo box is changed, that could tell me which DropDown was changed.
DropDown1_Click() seems to be the only option i can find, but is there a way to not have to create a unique method for each object?
View 9 Replies
View Related
Aug 17, 2009
How do I have a macro execute anytime a checkbox, or radio button is clicked on a form? I have a macro that needs to run, but I don't want to put it in the code for every checkbox because it will complicate any changes or additions to the form.
View 9 Replies
View Related
Sep 10, 2009
I have recorded the following macro and wish to add unprotect (with password), run the macro - which formats the worksheet and then password protect all cells with the exception of range E15:H413 which I want to leave editable by users.
View 9 Replies
View Related
Apr 2, 2008
I have code in the NewSheet event of ThisWorkbook which tracks new sheets being added. But when a worksheet is added by copying an existing worksheet this event doesn't seem to be triggered. Buy logically a new sheet has been added to the workbook so the event should be triggered. Is this a design flaw or am I missing something?
View 7 Replies
View Related
Jul 2, 2009
I have a worksheet containing a cell (say A1) that has a validated list of times (data/validation/list) where the cells in the list contain times in 8 minute increments. The user can select cell A1 and manually select any of the validated times from the list. A vlookup formula on this worksheet uses the content of cell A1 to look for this time in another section of the worksheet. When the time is selected manually, the vlookup formula works properly.
As part of a macro, the macro will change the time in cell A1. I do this in the macro by selecting and copying the desired time from the validation list and pasting it into A1. Cell A1 does change to the new value, however the vlookup formula that uses A1 shows a result of #N/A. If I manually change the time, it again works. I am looking for a way to have the macro change this cell to another time and for the vlookup formula to work as it should.
View 2 Replies
View Related
Jun 21, 2012
I would like to create a macro that will automatically change the name of the sheet any time a value is entered into cell a1. For example, in cell A1 of sheet1 I would input "Hello", and then the tab for sheet1 would be automatically renamed to "Hello".
Here's the twist - the workbook will have multiple sheets, and I want all tabs to reflect the value of a specific cell (a1) in each sheet.
For example:
value in sheet1, cell a1 = "Yes" - corresponding tab name would change to "Yes"
value in sheet2, cell a1 = "No" - corresponding tab name would change to "No"
value in sheet3, cell a1 = "Maybe" - corresponding tab name would change to "Maybe"
etc...
The "tab change" cell would always be cell a1 in each sheet.
View 2 Replies
View Related
Dec 6, 2013
Colouring calendar entries based on a date match... VBA to colour a cell on each line based on date match
The code works fine if you change the date in the cell and press enter however my date changes are triggered via a Vlookup which the code doesn't recognise has changed so doesn't trigger the macro.
Is there any way to amend the VBA code shown below so that it triggers the macro when dates are changed in column I via Vlookup?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("I:I")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Target.EntireRow.Interior.ColorIndex = xlNone
[Code] ......
View 3 Replies
View Related
Dec 18, 2013
- A database sheet called 'QAEQUIP' which contains information on the movements of pieces of equipment. This information in in order of Column A which is a movements reference number.
- A reporting sheet called 'Email sheet', which you put in a month and year and using macros it copy and pastes the relevant rows from the database and puts them in date order (e.g. put in October 2013 and it will show all of the equipment moves that happened in October 2013, and in date order).
What my end user would like, is to be able to add text to an extra column on the reporting page which gets fed into the database on the corresponding row. What would the best way to do this be? I was thinking VBA for each row (there aren't that many rows) that says if this cell is changed, copy and paste the cell into the corresponding row / column on 'QAEQUIP'.
View 4 Replies
View Related
Aug 25, 2008
I have found a macro that should work with a change of a specific cell.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$7" Then
Call Button
End If
End Sub
However, the code doesn t work as with a change of A7 nothing happens.
A7 equals to result from a drop down list --> A7=A5(which is a drop down list value). The "Button" macro is a combination of 4 macros that get rid of zero values and names in pie charts (maybe this plays any role). The master macro is assigned to an object. The code is:
Sub Button1()
Sheets("report").Select
ActiveSheet.ChartObjects("Chart 140").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
False, HasLeaderLines:=True, ShowSeriesName:=False, ShowCategoryName:= _
True, ShowValue:=True, ShowPercentage:=False, ShowBubbleSize:=False, _
Separator:=" "...................
View 8 Replies
View Related