I realize that there are 100 posts asking this same question but I believe this question is unique. My actual data if far more complex, but I have attached a simple workbook to illustrate my problem. It is my understanding that the following code will generate a unique list of values. However, it does not work if an AdvancedFilter has been used previously in the code.
Here is my question: Do you need to reset the value of "CriteriaRange" each time you use AdvancedFilter, and if so, is setting CriteriaRange to vbNullString the best way to do so.
I need to transpose into 2x2 range to use as criteria for advanced filter
I tried
arrCrit = Array("Accnt_Nmbr", "313000", "DT", "RV") Set rngCrit = wsData.Range("IU1:IV2")
rngCrit = WorksheetFunction.Transpose(arrCrit)
Where Accnt_Nmbr and DT are Column Headers in the data to to filtered However when I run the output includes all DT's (Document Types) How can I expand so both criteria are used in the filter?
I'm having with creating a macro to filter some data from one sheet to another. I used the "record a macro" function to get the code I've posted below but part of the code is always changing.
In my workbook I have a main sheet called "Data" and another sheet called "Parts". The code below does what I need it to do, but the problem is that the cell range (A2:I139) is not constant and may change depending on how many rows of information I import on the "Data" sheet.
What I'd like to have happen is either have a dialog box pop up and prompt me to select the cell range (I've tried using the Application.InputBox function but can't figure it out), or since the first cell will always be A2 and the last column will always be I, have excel automatically figure out the last row that contains data.
In Excel I recorded a macro by carrying out some operations and then copied the code into VBA code window to the click event of a button expecting the code would operate well but in vain. What is wrong with my operations? By cliking command button placed on a userform I want to copy the date of one column to another and the data thus copied into another column should contain only unique value.
I have data from Columns A to D. I want to do the following:
1. Look for duplicates in all column A
2. For each duplicate found in column A, check if all values in column B are also duplicate.
3. If the condition in (2) is satisfied, compare column D for all the rows; select the row with the minimum value in column D, and delete the other rows.
Is there a way that I can tell my VBA code to select the first row that my advancedfilter is showing? The row number changes, depending on the criteria selected. I need to be able to select this row, so I can hide the first row the filter is showing. I tried an offset command, but that just selects one of the rows hidden by the filter.
I am trying to use the advanced filter code to move all unique items from one sheet to another sheet. For example, I have two sheets named (1) "data" and (2) "output". I want to filter a list of unique items only from the "data" sheet and copy the data to column A in the "output" sheet. The code posted works fine if I keep the unique data in the same sheet, but I can't figure out how to copy to the "output" sheet.
I'd like to say that this Forum is helping me very much when reading so many useful topics, get help from ppl here. From nothing I advanced my program very much. About my problem here:
I have an Excel Column with Dates (dd-mmmm-yy) and an UserForm/ComboBox. I'd like to add only the unique dates from the Excel Column to the ComboBox. The Excel Column Range is updating with new dates.
I tried to use RowSource but i don't know how to get the unique dates with RowSource. Maybe RowSource is not a good decision.
is there any way to get an advanced filter to play with autofilters? at the moment after i have applied the advanced filter it completly messes up with my autofilter to the extent that it moves where the autofilter actually sits and then when i try and use the autofilter it completly ignores the advanced filter i just applied. how to make the 2 filters play nice together and actually be able to autofilter the results of an advanced filter.?
I have an auto filter setup on some data. When I perform an advanced filter either in-place or to another location, the auto filter disappears. Is it supposed to be have like that? If so is there some sort of work around?
I'm in the process of debugging some code at the moment and so have removed the On Error Resume Next's that I had in there.
I've since gotten rid of this where it wasn't necessary, but I have a general question about using the ShowAllData method with Advanced filter.
When I use:
ActiveSheet.ShowAllData
when there is no advanced filter applied, I get an error saying the method of Worksheet class failed.
I have searched and cannot find a way to check in VBA if there are advanced filters applied, though I can find code that will check if AutoFilters are applied. This doesn't work with AdvancedFilters.
I am trying to use the advanced filter with a not equal to operator, where the requirement is that the output not match an exact text string. I have tried <> and <>"???" (where ??? is the text string) and neither filter is working.
I'm using this macro to retrieve data from a worksheet within the same workbook. As you can see, I've set the destination range between row 12 and row 20. The problem is this code clears all text (not other formatting) from row 12 down even farther than the row 800 that is the end of my Origin range. QUE: How do you limit the reach of the ClearContents code?
Origin Name Range Definition = 'ORDERS 1st QTR 08'!$A$1:$J$800
Sub GetData() Application. ScreenUpdating = False Range("A12:J20").ClearContents Range("Data_Table"). AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _ Range("M1:M2"), CopyToRange:=Range("A12"), Unique:=False Application.ScreenUpdating = True End Sub
The data to be filtered is in several sheets, and once filtered is to be copied to a destination sheet (in this case "Temp"). The criteria for advanced filter is on an altogether different sheet (in this case "Reports"). The macro is actually simplified for the purpose of the question, and I want to re-use the code several times, hence the use of variable "filterRng". When I run it, I get the subject error at the bolded line in the code below. I'm thinking that the Advanced Filter doesn't like a variable as a range reference, as it runs perfectly well if the commented out line below the problem line is used instead.
Sub Test()
Dim i As Integer Dim rngData As Range Dim filterRng As Range
Set filterRng = Sheets("Reports").Range("A121:K124")
Is there a way to retain a formula when you have a drop down options that generates a date stamp? The problem is, i have this worksheet that has a drop down option on column B and generates the Due Date on column A, once an option is selected on the drop down list. After selecting, the output becomes static, but then overwrites the formula of column A, thus i guess making it static. I've had great help from this board helping me with the formula and the vb code. Is it possible? Here's an example of the formula and the ...
I am starting to use formulas and I am constantly amazed at the power of Excel. I am trying to write a spreadsheet and I'm having a problem getting Excel to do what I want; I have 2 column, each cell in Column 1 will have a numeric value changed daily. I want Column 2 to retain the highest value that has been added. i.e. If I type 4 in A1,(for example), on Monday, then B2 will read 4, if I type 5 in A1 the next day, then B2 will change to 5, but if I type a value less than 5 in A1, then I still want B2 to read 5. The value will be input daily for an indefinite period and needs to be user friendly. I can't work out how to achieve this.
I am creating a worksheet that uses a series of if formulas to determine the correct cell to use in a table outside the printing/viewing area. Something along the lines of "if X, Y, and z happens then use what is in cell AY34". I have the formula working, so I can get it to go pick up what is in the cell I want.
The problem I am having is that there is a heading to the text in cell AY34 that is bold, but the rest of the text in the cell is not bold. Is there any way to drag the formatting along with the data and not just the values?
I have a spreadsheet for recording property maintenance. All properties are grouped by a city zone in a specific colour, and there is conditional formatting on this. Also drop down lists for properties, contractors etc.
This all worked well, until I needed to start inserting rows. All the conditional formatting and lists didn't replicate on the newly inserted rows.
Also, we need to assign a unique reference number to each row but currently manually inputting them - very inefficient way of doing this as they will inevitably get mixed up and confused as rows are removed.
I am using the VLOOKUP function in a cell, however, I would like the value returned to also retain the text format from the table (eg colour and bold). I have attached a simple example (to demonstrate the point) where cell B14 should have the word 'French' in bold red.Example.xlsx
I have a template A that has lines on it, sometimes I want to overlay template B which has other lines on it, however when I past template B on top of A the formats of A are overridden by the formats of template B.
Is there any way of "overlaying" B on top of template A without losing the template A formats?
Cell M contains the number 001-1234 Cell N contains the number 1234567 (I have formatted the cell to appear with a dash at the beginning -1234567 Cell O contains the number 891 (I have formatted the cell to appear with a dash at the beginning -891)
I want to combine the three cells and have the number look like this 001-1234-1234567-891
Is there a formula that will do this
I have tried the Concatenate to combine the cells but it just combines the numbers and won't let me format the number as I want it.
I have created a multiple choice quiz maker that randomizes the questions and responses. This means that the quiz questions/responses must be copied and pasted each time a new quiz is generated. But in doing so, Excel loses formatting (such as super and sub scripting) and some special characters (like pi, alpha, the degree symbol).
Is there a way to get such things to copy properly from cell to cell, sheet to sheet, using Excel?
Coworker was sent a spreadsheet with a singe column of loan numbers; some start with zeros, some don't. But every single cell ends with a "^". (Shift key and 6)
I am in a situation where I have to copy-n-paste text from a webpage into Excel. When I do this, the pasted text keeps the formatting of the webpage. The font is the webpage font. The background color is the background color of the webpage. Etc.
I know that I can paste just the text itself, without any of the formatting, by right-clicking, selecting "Paste Special...", and then selecting "Text" instead of "HTML". I am wondering if there is an option somewhere that will do this automatically when I hit CTRL-V instead of requiring me to pull up the Paste Special dialog box.