Using Macros For Custom Filter Giving 'Or" Criteria And Paste The Data In Sheet2

Sep 25, 2008

When I go one column and Click custom filter and give the command one number and or another numbers ( I Have attached an excel sheet with screen shot) This filters the data, and I need to copy the same and paste in the next sheet.

I have to do like this for about 20 times for 20 sets of data). I have already done this and pasted the data in sheet2. I did everything manually. ( sample sheet is attached) I need a macro to do this work for me.

When I run the macro If get 2 text boxes I can enter the numbers. and click ok,the data has to filtered in sheet1, and result has to be pasted in the next sheet.with the header. Again I will run the macro i will give 2 numbers and the result should be pasted in sheet 2 after the 1st set of data leaveing one row as blank. ( exactly like the sample data in sheet 2). If I run the macro for 10 times giving 10 different numbers, the result should be pasted one after the other in sheet 2.

View 3 Replies


ADVERTISEMENT

Copy And Paste Function Messes Up Because Of Custom Sort / Filter?

Jun 5, 2013

what I do with excel: I have an excel sheet that has over 18,000 rows in it. Since it would be a nightmare to scroll around to find what I want, I use the Custom Sort and Filter options under Editing>Sort&Filter. So for example, I can omit 17,800 rows using a specific setting so that I can work with a more reasonable 200 rows. Moreover, the 200 rows comes from all over the spreadsheet. Meaning their row numbers are not always consecutive.

Here's the problem: Whenever I try to copy anything from this "edited or filtered" excel sheet, the resulting paste is not an exact copy. Excel perfectly copies the first rows up until the point where the row numbers ceases to be consecutive. So, the copy function messes up somehow when the data being copied comes from a different section of the original 18,000 rows.

In case this isn't clear enough...

Let's say that the original file has rows 1,2,3,4,5,6,7,8,9,10

Once I filter/custom sort, I see rows 1,2,3,8,9,10

When I try to copy/paste 2,3,8,9, excel copies 2,3, but messes up the rest of the 8,9. And I end up with a totally useless copy that's generally shorter than it's supposed to be.

View 6 Replies View Related

Excel 2013 :: Saving Custom Filter Criteria

Jul 30, 2014

I am trying to save filter options to so I can apply the same filter to multiple spreadsheets. For example, I have several spreadsheets with 50 or more school names and I am trying to set a filter that will filter out the same 20 schools each time. Is there anyway to do this in excel 2013?

View 4 Replies View Related

Creating New Workbook Then Giving It A Custom Filename?

May 25, 2012

I am building a macro and am just not figuring out how to do this. I am trying to create a new workbook, then give it a name. Simple right? Well, I have the format for the file name to be "mm-dd-yy Transmittal #.xlsx" but I can't figure out how to make the # part of that equation start as 1 but if the file already exists change it to 2, if that exists, change it to 3, and so on. Here's what I have so far:

Code:
Sub Transmittal()
Dim NewBook As Workbook
Dim MyPath As String

[Code]....

I don't think I'm allowed to do "x + 1" so that is probably where my problem is coming from.

View 9 Replies View Related

Command Button To Copy And Paste Current Month Data To Sheet2 VBA

Feb 25, 2014

In sheet1 I have different dates include different month as well.

I want to copy and paste current month data to sheet2 with command button.

View 5 Replies View Related

Merge Data From Sheet2 To Sheet1 Based On Required Criteria

May 1, 2014

I need to merge data from sheet 2 to data on sheet1.

Sheet 1 data is in the format given below with start date in G column and campaign ID in column H.

Start Date
Campaign ID

17-May-14
3834177

[Code].....

I need to look up Campaign ID of sheet 1 in sheet 2 and add all insertions and platform for that campaign to next columns i.e. I and J in sheet 1. For ex Campign ID 3834177 of sheet 1 has 5 insertions corresponding to it in sheet 2 hence the insertions and their Platform would transfer to sheet 1. Since Campign ID 3834177 is only in 2 rows on sheet 1, 3 more rows would need to be inserted in sheet 1 to accommodate 5 items and it would look like.

Start Date
Campaign ID
Insertion ID
Platform

[Code].....

View 1 Replies View Related

Code To Filter And Search For Criteria And Cut And Paste To Another Tab

Feb 19, 2014

What I have is a workbook where I have to filter on a column called "Code" in a worksheet called "Current" and search for varies criteria and then copy these filerted rows and paste into a worksheet called "Past" and then delete the orginal rows form the "Current" tab.

e.g. filter on a column called "Code" and filter on the criteria that match "Monday", "123" and "Customer Accepted" and paste at the bottom of the "Past" tab and then delete from the "Current" tab. A message should then be displayed saying "Data Transferred OK" with the curser then highlighting "A1" on the "Current" tab.

The only cavat is that the code may find none, some or all of the required criteria, however, in the event of finding no matching data then a message should then be displayed saying "No Data Found" with the cursor then highlighting "A1" on the "Current" tab

As I have to repeat this to filter on various columns for various criteria I intend to modify the code accordingly, however, in once instance I will have to filter on a column called "Code" and filter on the criteria 1,2 and 3 etc but then I have to do second filter on column called "Code Extra" and then do a filter on the criteria 4, 5 and 6 so the additional code would also be good.

View 2 Replies View Related

Protected Sheets With Macros Giving Runtime Error 1004

Mar 3, 2009

I created several macros objects to do simple hide columns, filter on, filter off, etc. type functions, using the Tools / Record Macro feature. Then discovered they won't work in a protected worksheet. Is there a way around this situation, other than turning protection off? Here's an example of the code for one of them, although I get the error or every attempt to perform a macro once the sheet is protected:

View 4 Replies View Related

Automatic Custom Filter On Dynamic Data

Nov 27, 2008

I need a function/macro that will find all rows that have a specified value in column A and extract selected columns to a new spreadsheet. More, I need it to do it for every value in column A.

I would also like it to skip creation of new worksheet if value in selected row and column is null.*

I've been trying to combat this problem with advanced filters, which helped, but due to size of the data and range of values in column A it takes an entire day to process manually. Because the data is exported to another program after it's processed, it can't stay in the same sheet, also, linking back to the original sheet doesn't work because the data changes all the time.

View 4 Replies View Related

Excel Macros To Transfer From Sheet2 To Sheet1

Feb 5, 2014

i have created a catalog with an invoice, sheet 1 is my invoice and sheet 2-36 are the different categories. I need to transfer data from sheet 2 to sheet 1 Containing QTY, Item, Item ID and Price. from my understanding here is what is needed to start the transfer from sheet 2 to sheet 1....

sheet 2 (catalog)

A -- B -- J -- M
QtY -- Title -- Item ID -- Price

sheet 1 (invoice)

A -- B -- E -- F
QTY -- Title -- Item ID -- Price

View 14 Replies View Related

Show Custom Error Message When No Data To Paste

Aug 27, 2007

Below is a macro I recorded to help copy 'Paste Special - values only' data between two spreadsheets that have different colour and conditional formatting in cells.

However, if this is run and there is no data to paste, it throws up the End and Debug error.

Any chance that someone knows that if there is no data sitting on the Clipboard, then a msg box would appear saying "Please select the data you require to be copied" in the message box.

Sub data_input()

ActiveSheet. Unprotect
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B5:AG4804").Select
Selection.sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("B5").Select
ActiveSheet.Protect

End Sub

View 4 Replies View Related

Special Cells Paste Giving Error

May 29, 2006

I am trying to use the Special Cells Goto and Paste, but I am getting an error saying 'this operation requires the merged cells to be identically sized' when I do the Copy the value that I want, Goto Special|Constants, then Edit|Paste Special|Values|Multiply. The cells containing constants are selected and if they are together, e.g. B7 & B8, then there is no problem, but if they are apart e.g. B7 & B9, I get the error.

View 5 Replies View Related

Copy And Paste From Filter Data?

Jun 9, 2014

How can we copy and paste filter

For Example I have copied table data and want to paste same date in J and K column then how can I do this ?

File is attached for ref : Copy and Paste.xls‎

Actually my Basic question is how can I copy data from filtered data and paste in visible cells only

View 8 Replies View Related

Filter The Data By Each Store And Paste In The New Sheet

Jul 9, 2008

I have the master data in sheet 1 with the some details of different stores eg store 1, store2, store3 etc which are in Column D.

I need to filter the data by each store and paste in the new sheet.
If i use advance filter>copy to another location, the system is not allowing to select different sheet.

is ther any way that If I run the macro, the data is filterd by Store names and the same data should be pasted in a different sheet with the store name. that is all the data related to Store1 should be pasted in Store1 Sheet.

View 9 Replies View Related

Copy One Cell And Paste Into Next Available Row On Sheet2

Feb 25, 2008

I have a live stock quote that refreshs every second (for reference, Sheet1A4), I would like to paste value A4 into next available row on sheet2 of the same workbook.

If possible, I would like to be able to copy several cells on Sheet1 and paste them in various sheets within the same workbook. Can you help me out or point me in the right direction to a previous thread.

View 9 Replies View Related

Use Cell Data For Filter Criteria

Feb 15, 2010

I have had no luck searching for an answer so better to ask. I am using auto filter on Sheet1 and filtering a column of dates. What I need is for the criteria for the auto filter to be pulled from cell H1 on Sheet 2. Is this possible or is auto filter the wrong direction to go? I am looking to find all the rows on Sheet 1 that contain the date found in cell H1 on Sheet 2. Then I am going to cut and paste that data to another worksheet. I think I have all the rest of it figured out but am stumped at the filtering portion.

View 9 Replies View Related

Filter Data By Criteria Into New Worksheet

Feb 12, 2008

I have problem with a database, I want to export data that is linked on a autofilter to a new worksheet,but I don't achieve in doing this. basically I want to copy all the data of a column which is selected by the autofilter (but not on the column i want to export) to a new worksheet; the layout of the database is fixed and may not change. I have made a replica of the database showing the same kind of layout but with less data so it would like to export all data in column D that is actived from the active autofilter (which can change )

View 4 Replies View Related

How To Filter And Copy Data From One Sheet And Paste To New Worksheet

Jun 2, 2008

can excel do this (see the attachment pls). if possible can someone show me how to do that. i am new in excel vba.

View 9 Replies View Related

Cut Row / Paste In Sheet2 And Shift Cells Up In Sheet1

Jun 22, 2012

I have this code (command button1) which works just fine. What it does is if cell 02 in sheet1 is "14" then it copies the entire row to sheet2. The same goes for all O column

I would like to change it a little bit.

Instead of copy i would like to cut the row, paste it in sheet2 and shift cells up in sheet1

Code:
Private Sub CommandButton1_Click()
Dim FirstAddress As String
Dim myArr As Variant
Dim Rng As Range
Dim Rcount As Long
Dim I As Long
Dim LastCol As String

[Code] ........

View 9 Replies View Related

Advanced Filter For Data Not In Criteria Range

Aug 12, 2006

I m Playing around with AdvancedFilters. Using the code below I can filter for data in the CriteriaRange, but I want to filter for data not in the CriteriaRange. I can't seem to find out to do this. I'm wanting to execute this sub from a button on a userform.

Sub Filter1()
Range("Data").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("CRng"), Unique:=False
End Sub

View 8 Replies View Related

Show/Filter Data From Formula Criteria

Apr 10, 2008

Im looking for a way to select between multiple choices linked to one criteria. Eg criteria beeing Chain x Article 1, which should give me the option to show and select from multiple unique values linked to that criteria (in attached example values 1 or 30 in column AQ marked in yellow). If possible solution should be formulas/functions.

View 2 Replies View Related

Can't Run Macros Off A Custom Toolbar Anymore

Oct 6, 2009

A couple years ago i made a giant spreadsheet and had 2 custom toolbars to run macros from to manipulate the sheet.

This year i re-did the sheet, meaning all my old data was replaced (it's a giant schedule basically).

However, the Macros in the custom toolbars stayed exactly the same and performed the same function and are directed to the exact same cells, rows, columns, etc..

But now when i hit the buttons on the custom toolbars to run my macros, i get the following message... all the time...

**
A document with the name "NHLsheet.xls" is already open. You cannot open two documents
with the same name, even if the documents are in different folders.
To open the second document, either close the document that's currently open, or rename one of the documents.
**

Trouble is, i have only 1 document open!
There's something in the macros that thinks i'm trying to open a new document but i'm clueless as to where or why.. they are very simple macros
that do not require the opening of any new workbooks..

All they do is point to another sheet within my open workbook, "NHLsheet", copy a particular row from that sheet, and paste it to a specific spot onto another sheet within my workbook, "NHLsheet".

Here is a sample:

View 14 Replies View Related

Sharing Custom Menus & Their Macros

Aug 26, 2008

Our ERP system generates reports in CSV. I have created a custom excel menu, which houses a lot of buttons that launch various macros to format these reports. I have been asked to share these formatting macros with other users.

I understand that the custom menu structures are stored in an excel11.xlb file. My thought was to simply replace the users *.xlb file. This only half worked. I get the menus and the macros, but when the users try to run the macros from the menu excel can't find them because the path is pointing to my user name.

View 3 Replies View Related

Creating Custom Tool Bar For Macros In Workbook

Jan 6, 2013

I want to create a custom tool bar for a work book but when I right click in the unused part of the tool bar area the only options I get are customize Quick access tool bar and customize the ribbon.

View 3 Replies View Related

Filter Table To Show Data Meeting Wildcard Criteria

Apr 10, 2008

My goal is for any of my team members to be able to use a macro to delete all of the unwanted text from a fairly large worksheet and only show their specific information. I created it for myself and posted a slimmed down version of it below. Instead of the macro deleting any rows that do not have BRANDON SCOTT in column D, I want a pop up box to enter your name, and then any rows that do not have your name in column D will be deleted. I’m sure it is something simple, but I have not been able to find another forum with this information.

Sub MyTeam2()
With Columns("D")
. AutoFilter field:=1, Criteria1:="<>BRANDON SCOTT*"
.Resize(Rows.Count - 1).Offset(1).EntireRow.Delete
.AutoFilter
End With
End Sub

View 3 Replies View Related

Return All Cells From Sheet1 That Meets The Criteria On Sheet2

Feb 10, 2014

As per attachment, see data : 2604 Stock.xlsx

On sheet 1 column A and B. On sheets 2 I would like to make a seach tab - so if the people type part of the word or code it must return all the data from sheet 1 to sheet 2 that meets that criteria in full or part thereof. I have tried but can't get it to work, might it be that it is on 2(two) sheets ?

I do not understand code so I really do not know what to do where. Basically it should work as a Ctrl-F (find-all) function.

View 1 Replies View Related

Insert Rows Based On Criteria Match From Sheet2

Mar 12, 2007

There are many columns in Sheet1 and more will be added for titles of the columns remains unchanged. One of the Col. in Sheet1 is 'Part Number'. Part Numbers are defined as 'Configurations', and each Configurations has additional parts and peices which are broken down in Sheet2. Back in Sheet1, I also have a Col. for QTY. So, if Sheeet1 has a part number that matches in Sheet2, then I would like Excel to copy all 'parts and pieces' and QTY from Sheet2 to Sheet1. Please make sure that I want the QTY to be multiplied if applies. Please see below for an example:

Sheet1 looks like this:...................

View 2 Replies View Related

Copy Selected Cells From Sheet1 And Paste Them In Sheet2 Based On A Cell Value?

Dec 27, 2012

have two worksheets, "Entry form" and "Database" in my workbook. I am trying to put together a macro button to find the cell value D5(Entry form) in the column A:A (database), if found, copy selected cells (B5:D5,B7,B9) from entry form and paste in the adjacent cells of the row with the value in the database sheet.

VB:
'Match value D3 and replace data
Dim sht As Worksheet, outsht As Worksheet, r As Long
Dim rfoundCell As Range

[Code].....

View 9 Replies View Related

Custom Function To Sum Visible Cells Clashing With Macros

Oct 23, 2007

I have a custom function that is interferring with VBA. If I remove the function the VBA works fine, if I put it back to do what it needs to do, the VBA does absolutely nothing. Any ideas on how to make things work together? Here is the custom function and it is in a module where the VBA that isn't working is in the main Workbook page, but it is a Worksheet Change VBA affecting the same page as the custom function.

Function Sum_Visible_Cells(Cells_To_Sum As Object)
Application.Volatile
For Each Cell In Cells_To_Sum
If Cell.Rows.Hidden = False Then
If Cell.Columns.Hidden = False Then
total = total + Cell.Value
End If
End If
Next
Sum_Visible_Cells = total
End Function

View 8 Replies View Related

Advanced Filter Code - Criteria Range More Than 1 Row Breaks Filter

May 1, 2014

I found a great bit of Advanced Filter code that works great, and fixed a problem of clearing a cell breaking the filter.

But if I want to increase the criteria from 1 row to 2, so you can start to include And , Or operations, it breaks the filter. Even an attempt at a manual one fails, until you put the criteria range back down to one row, then it's fine again.

I've tried changing the Target Row to >2 but that didn't work. how to make the criteria range bigger, and no problems of breakage if you clear the cells? It makes for a very useful automated Advanced Filter.

Here's the code :

[Code] .....

Database = the named area of raw data.
DATA is the name of the raw data worksheet
The criteria range should be AZ1:BC3, but of course royally breaks it...

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved