Macro To Find Criteria And Copy To Next Page

Feb 10, 2014

I am in need of a macro that will:

1. Check cell B1 for my named regions
2. Find all citys in that region from another worksheet
3. Copy the specific details
4. Highlight the information that has just been copied and create a bar chart for comparison

Data to be picked up from "Inc 8%" sheet.

Headings are the same on both the worksheet the information is being taken from and being pasted to.

I need City, Year 1 Turnover - Year 10 Turnover data to be copied.

Region Help.xlsm

View 2 Replies


ADVERTISEMENT

Macro To Move Line To New Page When Criteria Met

Jun 17, 2014

I have been using the below macro that has worked a treat, however I need it to copy as value as when it moves over some of the formulas and links go a little funny.

[Code] ......

What amendment I would make so that it pasted special as value?

View 1 Replies View Related

VBA Macro To Insert Horizontal Page Breaks Based On Criteria Of 1 Column

Jan 10, 2010

I want to achieve is a procedure that inserts horizontal page breaks at certain parts of the sheet where there is a cell equal to 2. Here is the code I have so far.

Sub insert_pagebreak()
Dim printbreak_cell As Range
Dim j As Long
Dim i As Long
ActiveSheet.ResetAllPageBreaks
Set printbreak_cell = Range("AD1")
j = 1
For i = 1 To 100
If printbreak_cell.Value = 2 Then
Set ActiveSheet.HPageBreaks(j).Location = printbreak_cell
j = j + 1
End If
Set printbreak_cell = printbreak_cell.Offset(1, 0)
Next i
End Sub

Everything works until the cell value reaches a 2, and then once it goes into the If statement I get a 'Application-defined or object-defined error' at the below line.

Set ActiveSheet.HPageBreaks(j).Location = printbreak_cell.............

View 3 Replies View Related

Macro To Access Website Page & Copy Table

Jun 27, 2008

I'm doing some extremely repetitive work with a web tool at work. I need to import about 1800 tables for my first assignment and 5000 for my second. I did a search on the forum and found out that Excel and vba is able to import tables from a website's chart which is amazing. I recorded a macro and got

Sheets("Sheet2").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL I can;t give out this information" _
, Destination:=Range("A1"))
.Name = "index"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False.....................

For each session I have to go to my site, log in with a username and password which is the same everytime then go to a specific page select the right drop down and import chart. The Chart under the drop down is the chart I need to import. The macro I recorded has no problem doing this but however it keeps grabbing the same chart, how do i fix that, so it knows to select the right drop down then import the right chart?

View 3 Replies View Related

Macro - Choose From Dropdown List Then Copy Page To New Sheet

Jan 3, 2013

I am after some VBA code that chooses each value from a drop down list (in cell A1) then copies a separate sheet 1 (sheet 1) into another workbook (can have both workbooks open at the same time or the first step will have to create a workbook) with the name of the added sheet renamed to the value chosen from the list. When the second value is chosen then sheet 1 should be copied into the newly created workbook as well.

Sheet 1 has lookups that are updated when the new value in the drop down list is chosen

There are around 85 values in the drop down list so I'm expecting a workbook with 85 tabs (copy pasted values and formats)

View 1 Replies View Related

Macro To Print Page Based On Active Page

Jun 29, 2007

I need a macro that will print a hidden page that is linked to the page I have active.

It needs to be able to find the correct hidden page that corresponds to the active page because there are multilple pairs of the hidden/visible pages. The name of the hidden page is the same as the visible one with "printout" added to the end. When created, the sheet code names are sheetn and sheetm; n and m being consecutive numbers.

View 3 Replies View Related

Macro Code: Find Cell Or Row Multiple Criteria

Sep 14, 2006

I can't seem to find the answer to this. In VBA, how do you Find a cell or row based on multiple criteria? All I need is to find it's location. If it helps, here's an example:

Sheet 1 contains source data:
Date Name Time Complete

Sheet 2 contains an interactive worksheet using this data. On Sheet 1 there's an entry: 9/12/2006 George 03:30 PM

Sheet 2 displays those records with adjacent cells for entering data. When data is entered, I need the system to go back to Sheet 1, find the entry that matches this one, and put an "x" in the Complete column.

View 6 Replies View Related

Macro To Search A "database" In A Different Workbook And Copy Whole Page When Matched

Jul 14, 2009

I need another big macro to search a different workbook "database" for a match. An example of what the "drawing number" will look like that the macro will search for is;

View 5 Replies View Related

Macro Used Textbox In Worksheet Rather Than Cell Reference As Criteria To Find Matches

Sep 26, 2013

This is a continuation of thread 182629 [URL] ....

The End User wanted originally to type characters into cell C1 of a worksheet that the macro searched for in another worksheet, copying across every row containing the input.

The responses gave me the following code which worked perfectly:

VB:
With Sheets("PICKLIST")
myFind = "*" & .[c1].Value & "*"
End With
If myFind = "*" & "" & "*" Then Exit Sub

Unfortunately, the user NOW wants a Text Box instead of putting the characters into a cell.

I added a textbox (originally called 'TextBox2' but renamed "Choice") and "Dimed" CHOICE As Range.

Then tried the following code:

VB:
With Sheets("PICKLIST")
myFind = "*" & CHOICE & "*"
End With

But it generates a "RunTime Error 91" - Object variable or With block variable not set.

View 8 Replies View Related

Macro To Copy / Change And Paste With Different Criteria?

Aug 5, 2014

I have a file that needs to copy/change and paste data if column H has the following 3 abbrev but each of them has its paste criteria. see details below.

1) In column H, if abbrev ="Prod 10", insert 9 rows and then copy and paste but the codes in column G of the copied rows need to change to different numbers.

2) If abbrev ="Prod 4", change the code of the following 3 rows to 44298.

3) If abbrev ="Prod 14", insert 13 rows and then copy and paste.

Is it possible to have a macro to do these tasks?

View 4 Replies View Related

Macro - Find Then Copy Row(s)

May 28, 2007

I have a spreadsheet with 20 sheets, with each sheet representing work done by an individual. The sheet would contain all the tasks and the percentage of work alotted. I now need to capture all these in a summary spreadsheet BUT only if the task is "IN PROGRESS" which is indicated in one of the cells.

Currently, we're doing it manually and it is a pain to go through all the names and copying the rows one by one. The summary should show the names with the corresponding project name and allocated time (copy whole row).

View 13 Replies View Related

Find And Copy Macro

Oct 30, 2007

I'm trying to come up with a macro which will go through column A once searching for a value (ex. "apple") and upon finding a cell with that value, take cells 79-100 from that row, copy them to cells 82-103 of the next row, and delete the row which contains the value.

I believe the functions I need to use are:

View 13 Replies View Related

Macro To Find And Copy On The Row

Nov 16, 2012

I have the following code. It runs fine and I get the popup msg at the end but it doesn't do what I need.

Range w2 is a date. I want the macro to search for this date in Sheet2 just in Column B and when found copy everything on the row it is found down to the end of the worksheet whatever row that might be and then go to sheet1 and paste this below the last used row!

Code:
Sub test222()
Dim FindWord As String, Found As Range
Dim wsDest As Worksheet, ws As Worksheet, wb As Workbook
Dim Nextrow As Long, Lastrow As Long

Set ws = ThisWorkbook.Sheets("Sheet2")

[Code] ........

View 3 Replies View Related

Find, Copy Row Macro

Oct 8, 2009

I know this is probably something easy, but I can't seem to find the answer. I am trying to create a macro that will look for the number 5 in column C and if found, copy and paste the entire row below. I need it to find all instances of the number 5 in column C and copy the row below.

I found the code below that seemed like what I needed but when I changed it to look for the number 5, it didn't work. I have tried putting 5 in quotes "5" and that doesn't help. Below is the code and sample data.

Sub OT()
If WorksheetFunction.CountIf(Columns(3), 5) > 0 Then
Dim xRow&
xRow = Columns(3).Find(What:= 5, LookIn:=xlFormulas).Row
Rows(xRow + 1).Insert
Rows(xRow).Copy Rows(xRow + 1)
End If
End Sub

Original Data
J4R N166888520J4R N166888180J4R N40018524J4R N400185176J4R N40018558

What I want it to look like
J4R N166888520J4R N166888520J4R N166888180J4R N40018524J4R N400185176J4R N40018558J4R N40018558

View 9 Replies View Related

Find & Copy Macro

Aug 21, 2007

I'm using Macros. I have a workbook composed of three sheets "Anzahl" "Tabelle 1" and "Sheet1".

For "Sheet1" I want to create a macros that will search for the word "Sonntag" in the B column and then copy the corresponding values in the C and H column to a different part of the sheet. I have used the following code

Sub SearchAndInsert()
Dim i, k, k1 As Integer
k = 3
k1 = 3
For k = 1 To 355
If UCase( Range("b" & k).Value) = "Sonntag" Then
Range("c" & k).Select
Selection.Copy
Range("p" & k1).Select
ActiveSheet.Paste
Range("h" & k).Select
Selection.Copy
Range("q" & k1).Select
ActiveSheet.Paste
k1 = k1 + 1
End If
Next
End Sub

However, everytime I hit the run button or press F5, nothing really happens and nothing is copied.

View 8 Replies View Related

Macro To Copy Data To Other Sheet Based On Criteria...

Feb 19, 2009

We're working with a large workbook with data from A5:P20000 on sheet1.

I need to be able to pull data from sheet1 to sheet2 based on the invoice number in column A on sheet2.

Sheet2 will have different invoice numbers in column A, some of these invoices numbers are in column H on sheet1. I need excel to find these invoice numbers and copy the data from that row on sheet2 to the row with that invoice number on column2.

Example:
Sheet2 A5 has invoice number 1234457
This same invoice number is located on sheet1 H3400
Need to copy to sheet2 (starting in cell B5) the following cells from sheet1 (B3400, C3400, E3400, G3400, H3400, I3400, J3400, K3400, M3400, N3400).

View 15 Replies View Related

Macro: Copy Data Based On Criteria/Condition

Oct 16, 2006

Attach is a sample of my project. I have to loop through B9:B80 in sheet("Raw Data") and capture the value of each cell. EG:

* if Value captured is 120A --> check with sheet("SP14F") from the row which contains the same value.

* i have to check that the aperture, outer and inner values of Layer 120A and so on..of the Raw Data sheet is the same as that of in the SP14F sheet.

* if the values are not the same, change the font to red

i understand that this task requires looping and arrays.

View 4 Replies View Related

Selection.Copy And Find Macro

Mar 7, 2007

I have is two spreadsheets with different data on them, but the only connector is the user ID, so I want the cell I select with the user ID to be copied it then switches to the other spreadsheet and finds the copied selection, it then takes the columns on the selection of A to J and pastes them back in the other columns in the other spreadsheet.

My only real problem is that I can't get it to use the selection.copy in the find to select the cells I need, any help would be great, thanks.

Code ( i put spaces bewteen the other parts and find function so you could easily see it):

Sub Macro1()

Selection.Copy
Windows("EMERA-employees-asof-06-Mar-2007.xls").Activate

Cells.Find(What:="(I want this to be selection.copy)", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

ActiveCell.Columns("A:J").Select
Application.CutCopyMode = False
Selection.Copy
Windows("SMSReportResults.xls").Activate
ActiveCell.Offset(0, 6).Range("A1").Select
ActiveSheet.Paste
End Sub

View 9 Replies View Related

Find Value, Copy And Paste Macro

Apr 27, 2007

The macro finds the value in cell D11 (which is the name of a product) in a worksheet called "Summary1". It then looks for this value in another worksheet called "Output", specifically in a column with a named range called "Products". If the value being searched is found in the "Products" named range column (in the worksheet "Output"), the code below copies the entire row for it, to another sheet called "OutputSummary1". I would like to change the code as follows:

1) Instead of copying the entire row, for which the searched for value is found, from the sheet "Output" to the sheet "SummaryOutput1", I would like to instead only copy the values in columns A, B, and E to the sheet "OutputSummary1". Also, I would like the values to be pasted pastespecial so that the formulas in the sheet "Output" are not copied over, and only the values are copied.

2) Secondly, I would like to know how to perform the find procedure (searching for cell D11 contents) on all sheets in the same workbook beginning with the word "Summary" (There will be worksheets called Summary1, Summary2, Summary3, etc. that the macro should be performed on.) As well, the pasting should be perfomed on all respective sheets called OutputSummary1, OutputSummary2, OutputSummary3, etc.

Sub CopyPaste()
With Worksheets(1).Range("Products")
Set c = .Find(Worksheets("Summary1").Range("D11").Value, LookIn:=xlValues) 'this identifies the value D11 in worksheet called Summary1
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.EntireRow.Copy Destination:=Worksheets("OutputSummary1").Range("a" & Worksheets("OutputSummary1").Range("a65536").End(xlUp).Row + 1)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub

View 7 Replies View Related

Page Break Preview It Shows The Page Numbers In The Centre Of The Page

Jun 9, 2009

When I view a sheet under Page Break Preview, it shows the Page numbers in the centre of the Page. While I am aware that it would not print the page number I was wondering if there is an option to remove/hide the page numbers.

View 3 Replies View Related

Macro To Select Multiple Files And Copy Them Based On Criteria?

Mar 10, 2013

This is what I am trying to achieve:

1) Prompt user to select a file (or multiple files)

2) Copy the files that meet certain criteria to a folder

My attempt (fail):
VB:

Sub FILES2SFTP() Dim FileNames As Variant Dim I As Integer Dim fso As Variant Dim Data As String ChDrive "G:" ChDir "G:TEST" Data = InputBox("Enter the date", "Enter the date", Format(Application.WorksheetFunction.WorkDay(Date, -1), "yyyymmdd")) Set fso = [code]....
I get error 424 object not found in this line:

If fso.getfilename(FileNames(I).Name) = ("Name1" & Data & ".xls" Or "Name2" & Data & ".xls") Then

View 3 Replies View Related

Clear All Criteria In All Autofilters On A Page

May 22, 2009

I have searched these boards (and found wonderful ideas), but can't find a better solution.

Is there a quick way to clear all the autofilters on a page (or all of them in 1 row)?

I am using this code, but it is very slow.

For i = 1 To 21
Selection.autofilter Field:=i
Next i

View 9 Replies View Related

Macro To Find Text And Copy Row Values

Jul 11, 2014

See attached spreadsheet for reference : MacroHelp.xlsx‎

I would like the macro to look in column I, and when it finds "TRUE", I'd like it to copy and paste values in all the cells to the left of it.

Reason being is that I want to rid the row of its formula, so the next time someone changes the info (the date the vlookup is searching for) in the tabs those cells are referring to, I will not lose the data it returned previously.

Really all I want is to copy and paste the values in the lowermost row of new information for each plant, but this is the best way I can currently think of.

I've removed the tabs the cells in columns B-G are referring to for sensitivity's sake.

View 2 Replies View Related

Macro To Find A String And Copy It To Next Cell.

May 13, 2009

find a string and copy certian string to next cell i have tried something which can copy but unforunately that is copying whole cell not certian string.

I have data of 500 rows and i have data till A,B,C,D and E.Please ignore all the other rows which are of no use except E in Column E i just need Reference : A0000000:1 to be copied to next column beside to it that means in Column F.

View 2 Replies View Related

Find, Offset & Copy To Another Column Via Macro

May 21, 2009

I am attempting to do is have a macro (Via Command button) go through column A to find the word "TOTAL". Once that is found I want it to offset by 3 rows (from the word "TOTAL") to grab the number and place it into column B.

View 2 Replies View Related

Macro To Find / Copy And Paste To Cell

Jul 26, 2013

I want to find data from a certain point and paste this to a cell. My objective is to get all the data on too one row. This row is always 1 in col M called Run#. The find locations never change, just the data being copied always changes . Heres example,

In col K find FHBASC and look across to the right 3 cells in col N and copy.
Look in col M and find 1, paste above copied data into col GI.

Then move down rows to next FHBASC and repeat process until end of sheet.

If I can get a very basic simple macro to do this, then hopefully I can just re write to suit my other data.

View 9 Replies View Related

Macro For Find, Copy, Paste, Repeat

Mar 24, 2009

I have 10 worksheets. They are labelled 'FEB', 'MAR', 'APR', etc...to 'NOV' (NB: JAN & DEC not needed). In column "G" on all these sheets I have the data as "CURRENT" or "OVERDUE". The first 3 rows on every sheet are headers, so the data starts at 'G4' on every sheet.

I then have an "OUTSTANDING" sheet which will display all of the "OVERDUE" items from the various months. I have an UPDATE_Click() event which when actioned needs to search all the column Gs in the month sheets and then copy the data from column 'B' to 'F' of the corressponding row to an "OVERDUE" result. The data from B-F then needs to be pasted in the next available row on the "OUTSTANDING" worksheet (starting at row 4, as first 3 rows are headers with merged and unmerged cells).

Nothing fancy, when the search go does the column and hits a blank cell that means its the end of the list and can move on to the next month.

View 9 Replies View Related

Macro To Copy Data From Columns And Paste In Rows After Given Criteria Matches?

Nov 21, 2011

I have a macro that would check data in Column A and validate if a particular number is repeating, then for that number go to column B, Take the Values from there go to a new sheet and paste the values in a row.

CurrencyDateRef CodeIDAccountAmountDes.USD07152011XDVU4315210.4200.C5001.USD-18,606,772.190Distr Payable 07152011USD07152011XDVU4315210.4200.C5002.USD-111,131.450Distr Payable 07152011USD07152011XDVU4315420.4240.C5001.USD18,606,772.190Distr Payable 07152011USD07152011XDVU4315420.4240.C5002.USD111,131.450Distr Payable 07152011

I get the data in the below format

CurrencyDateRef CodeIDAccountAccountAmountDes.USD07152011XDVU4315210.4200.C5001.USD420.4240.C5001.USD-18,606,772.190Distr Payable 07152011USD07152011XDVU4315210.4200.C5002.USD420.4240.C5002.USD-111,131.450Distr Payable 07152011

I need to the macro to get the data not from the second cell.

Below is my macro

Sub test()
Dim idRange As Range, c As Range
Dim uniqueID As String
Dim destSht As Worksheet, sourceSheet As Worksheet
Dim r As Long
Dim i As Integer
Dim map As Object, key, item

[code]....

View 2 Replies View Related

Print Page Based On Specific Criteria

Nov 10, 2006

I have a report which is split into page sized chunks, in column P I have an identifier Planned, Booked or Running.

Is it possible to build a macro which says something along these lines

If P1 = "RUNNING" Then
Print that Page
Else
Go to P44
If P44 = "Running" Then
Print that page
Else
Go to P87

and so on until the cell selected is blank then stop.

View 5 Replies View Related

Macro To Find Value In Cell And Copy That Row To Toher Sheet

Feb 1, 2009

I am working on getting a macro to find a name in column "B" and once found copy its row to another sheet. I have been working on an "IF" statement that checks for the given name and if true copies the row. I can not get it to keep checking and then stop using "loop" What i got so far:

View 2 Replies View Related







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