Macro To Move Cell Down A Row Based On Criteria
Feb 20, 2009
I would like a simple macro that would actually move a cell based on criteria. In my case it would be: In row A, if a cell starts with 'Agent Name' then that cell needs to move down one cell replacing the contents of that cell.
View 3 Replies
ADVERTISEMENT
Nov 16, 2007
I'm trying to do is loop through a range of cells, and if the cell meets a condition I want to move it and 2 cells to the right of it left by one cell.
Sub MoveRangeOfCellsBasedOnCellCriteria()
Dim myrange, cell As Range
Set myrange = ActiveSheet.Range("H2", Range("H65536").End(xlUp))
For Each cell In myrange
If IsNumeric(Left(cell.Value, 1)) _
Or Left(cell.Value, 5) = "UNIT " _
Or Left(cell.Value, 4) = "THE " _
Or Left(cell.Value, 5) = "FLAT " Then
Else
cell.Range("A1:C1").Select
Selection.Cut
cell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
cell.Offset(1, 1).Range("A1").Select
End If
Next cell
End Sub
View 7 Replies
View Related
Jun 9, 2014
Basically I want to copy and paste all data in a row if the value in a cell is equal to something
I am currently using the below formula
The Value in red = Set tgt = ThisWorkbook.Sheets(Criterion.Offset(, 1).Value 'Pick the cell next to the cell containing the criterion).
But my issue is now that i will need this to work based on 37 values and having this macro 37 times with the value changed and 37 buttons will be difficult.
So I am looking for a way i can add multiple values each going to separate sheets.
View 14 Replies
View Related
Oct 30, 2013
Ok so Im working on Christmas functions and this is how my data base looks
Date
Name
Address
Seats
Price
Total
1/12/2013
James Fran
1 Bold street
4
£20
£80
[Code] ......
What I need to do is move all the dates onto their own worksheet, so every row containing 1/12/2013 would move to the worksheet 1.12.13, the 6/12/2013 would move to the worksheet 6.12.13 and so on.
Currently I have to copy and paste each row manually, which takes time. Any macro or formula which would do this automatically every time new data is entered. The main database, like above, will contain around 200 entries.
View 2 Replies
View Related
Dec 4, 2011
I have a row of dates in row 2 (all sequential, from Nov through to June next year)
I have a row of number entries in row 3 (to correspond with the date in row 2 it was entered on).
I want to be able to add a new entry (a number) into a text box, click a macro button, which makes the text box input be moved into the cell underneath todays date (so every day the cell will move one column along)
I've managed to make myself a textbox, and a macro button, but I'm stuck with how to make it all work.
View 5 Replies
View Related
Nov 8, 2007
What I am trying to do is if on the (Open Project Issues) tab column F says "Closed" it will move that row to a tab called (Closed Project Issues) tab. I was trying something like this:
Sub testmove()
Dim c As Long
For c = ActiveSheet.UsedRange.Rows.Count To 2 Step -5
If Cells(c, 6) = "Closed"
Rows(c).Cut
End If
Next c.......
View 3 Replies
View Related
Jul 21, 2007
Cell a1:a3000 contains a lot of trackingnumbers. Cell b1:b3000 I have a "IF" formulas in place to write "ok" if part of the data in "column A" matches my criteria. What i need is a macro that will cut all the rows showing "OK" in column B from "sheet1" to the next availible row in "sheet2"
I have tried converting copy macros to Cut macros, but thye have not worked. I am rather hopeless for the coding part and mostly make macros based on the record feature. Also looked at the ones that have been showed here, but my skills do not make me able to change them to fit my excel sheet. About 8000 rows with data is added into this sheet everyday and the criteria is not always present. That means on some days there will be no "OK" showing in column B
View 3 Replies
View Related
Jan 10, 2012
Error in the code, where I'm trying to copy the data (based on criteria) from one worksheet to another, then delete the data from the first worksheet. In the code (I have complied from this message board) I get an 1004 error "Application-defined or Object-defined error".
Code:
Option Explicit
Sub CopyALColKYes()
Dim NR As Long, c As Range, firstaddress As String
Application.ScreenUpdating = False
NR = Sheets("Completed-Expired").Cells(Rows.Count, 13).End(xlUp).Row + 1
[Code] .........
View 9 Replies
View Related
Jan 3, 2014
I have four sheets with the same size tables and just need rows to be able to be moved back and forth based on input from a certain cell and just added to the next available blank cell in the desired table. Adding the code from the webpage below works very well but only puts into the worksheet and not into the actual table. Is there any way making it actually input the row into the table itself?
Creating Macro that automatically moves row to another spreadsheet?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 Then
If UCase(Target.Value) = "COMPLETE" Then
Target.EntireRow.Copy Destination:=Sheets("Archive"). _
Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.EntireRow.Delete
End If
End If
End Sub
View 1 Replies
View Related
Sep 7, 2009
I have 3 data series, which are each futures contracts. Each of these futures contracts (the one on the left expires soonest) has an expiration date and as that date approaches, one will need to replace it with a new futures contract (the data series immediately to its right) having a later expiration date. This process is called a ‘roll’. I am seeking to create a continuous data series, which will incorporate the appropriate ‘roll’ based on two rules.
The rules are as follows:
1) Where the volume of the 2nd contract exceeds the volume of the 1st contract for 10 consecutive intervals, roll on that date.
2) Once the roll date has been identified, roll at the specific time interval on that date that has the highest aggregate volume (between the 1st and 2nd contract).
I have laid out the original data in a tab entitled ‘original data stream’. This is how the data will appear at first. In the tab entitled ‘Roll Example’, I have shown what I would like to happen to the original data streams. You will notice that in this tab, the data series are the same as the previous tab, except that they are not aligned as before. The data series to the left ( cells B4: D808) expires ..................................
View 9 Replies
View Related
May 2, 2007
Here is the situation:
There is a spreadsheet that I use that has multiple plans in one column for various members. You can see the plan for Robert James and Amanda James is plan 5. If all this information was in column A how would you move the plan type say column C for each member?
For example
Column A
Customer Name
Robert James
Amanda James
Plan 5
Nikki Martinez
James Gross
Plan 6
View 4 Replies
View Related
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
Jan 29, 2009
I'm trying to create a macro that takes data from one row and inserts it into a new row. Attached is a workbook with a before and after example of what I'm trying to do.
Each row has a security transaction that includes principal cash and interest. The data needs to be formatted so that each transaction has one row for principal and one row for interest.
Principal is identified by the tran code PAYDOWN in column C. Interest is identified by the tran code INT. However, the raw data generated includes both interest and principal under the tran code PAYDOWN.
There could be 100 or 1000 transactions generated based on the day.
View 2 Replies
View Related
Oct 7, 2009
Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?
The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).
I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.
View 6 Replies
View Related
May 20, 2014
I'm new to macros. I have a data range of A6:H100.
If cells in column H (Complete?) = Yes I want the row moving down to the next available empty row.
Collection DateCustomer Order NumberNo of PalletsHaulierContact Date Collected Complete?
(I'm using 2003)
View 1 Replies
View Related
Sep 20, 2006
I have a spreadsheet in which the user will respond to questions using "T" for "True" or "F" for "False". If there is a certain number of T's I would like the macro to take the user to one sheet in the workbook or if there are a certain number of F's I'd like it to take the user to another sheet in the workbook.
View 2 Replies
View Related
Nov 5, 2009
I have had several intro programming classes, but not with visual basic. I've noted the problem lines with comments below. The problems are probably very easy syntax error.
Sub list()
Dim counter As Integer
Dim counter2 As Integer
Dim id As Double
Dim id2 As Double
Dim palletnum As Integer
ActiveSheet. Name = "Pallet Detail"
Sheets.Add
ActiveSheet.Name = "Pallet Summary"
Sheets("Pallet Detail").Select
View 7 Replies
View Related
Dec 5, 2012
I need write a VBA code that will move an entire row into a new sheet if the value of the last cell says "YES" If the value is blank then Id like it to stay in the current sheet. I would also like it if the cell wont allow any other value other than Yes to be typed.
I found this code here:
Copy, Move and Delete Row, based on Cell Value
THE VERY FIRST CODE REPLIED IN THAT THREAD.
I just cannot seem to get it to work. Simply copying and pasting that into the module doesn't work. I am not very good at VBA and just started taking a course on VBA. Id like to jump into this problem asap as I need it for work.
Basically:
Columns A:E will have values. In Column E I would like to type in Yes if completed. I would like the Macro to run through all of Column E and if the cell value is "YES" then I want it to cut the entire row and paste into a new sheet. In the new sheet I would like it to be pasted into the next available row.
Also can I create this with a ActiveX control button? I would like to have a button that I can click at the end of my work which will run the Macro in sheet 1.
View 6 Replies
View Related
Jun 21, 2009
I have a spreadsheet (Sheet 1) listing current Work Orders with each work order occuping a seperate row; Column E lists the status of the work order, with the status being chosen from a drop down list.
I would like to have a macro that will copy the entire row and paste into (Sheet 2) when the status is changed to CLOSED, and clear the contents of the cells on Sheet 1.
The aim of this being of course to have all open work orders on sheet 1 and all closed orders on sheet 2.
View 9 Replies
View Related
Sep 20, 2008
I have a simple projectlist on sheet1 formatted like this:
Column A=Projectname, B=Description, C=Owner, D=Deadline and E=Status.
On sheet2 I have the same columnheaders.
What I would like to do, is that if Status changes to "Done",
* the entire row should be copied to a free row on sheet2, or just inserted on sheet2.row2 without overwriting anything
* the now empty row on sheet1 should be deleted (so there're no empty rows)
* the data on sheet2, should be sorted with D as first key and C as second.
Then, if Status on sheet2 changes to "Reopened", the same procedure should happen but from sheet2 to sheet1.
My first choice was to create a checkbox on each row in the Status column,but I noticed it didn't seem to follow with cut/paste even though I changed the property Locked to false. Anyone knows if it's possible to change this behaviour?
I only know small bits of VBA but my idea is this: ...
View 4 Replies
View Related
Jul 16, 2005
I currently have a consolidated worksheet (thanks Bill!) called " Dashboard" that contains closed items that are marked by a validated column that can only contain "Closed, Open, or In-Progress." Is there a way to move the rows with a value of "Closed" to another worksheet called "Completed"? Also when this move is done, that row is no longer necessary in Dashboard and should be removed. So I'm guessing its a lot like a cut and paste and then a delete row/shift cells up?
here are some additional information:
The worksheet has a locked header that is 6 rows deep (the values for the "Status" column begins on row 7 and on.)
The "status" column is at column 11.
View 8 Replies
View Related
Jun 25, 2007
I would like to know if the following problem can be solved using only Excel without any operator intervention. Can a formula be created? If yes I would appreciate it very much
Problem:
If B5 = X
Move B6 thru K6 to B5 thru K5
And
Move B7 thru K7 to B6 thru K6
And than
Blank out B7 thru K7
View 3 Replies
View Related
Jan 15, 2008
I have a excel file to keep track of tasks or actions that need to be performed. What I am looking for, is an automated utility or code that will allow excel to automatically move entire rows (so an entire task) of completed tasks to another sheet called, "Completed Actions". In Actions sheet I have a column for " status" and here you have to select from a drop down menu, either "On-going", "Urgent" or "Done". What I would like, is that once you have selected "Done", the entire row or entry, will be automatically moved to the "Completed Actions" sheet.
View 7 Replies
View Related
Jun 3, 2012
I have two sheets:
1. Not yet printed
2. Printed
My data is in sheet 1 (Not yet printed). I would like to move automatically entiry rows (sometimes more then one) to sheet 2 (Printed) based on one cell's value. Here is a screenshot:
For example when I enter into Sheet 2 '264450' then row 2 would have been moved to Sheet 2.
And also with multiple rows, if I enter '264461' then row 4 and row 6 would have been moved to sheet 2 as well. I wouldn't like to enter a value more than once.
View 1 Replies
View Related
Jul 27, 2007
ABCDE
FGHIJK
If the above is in different cells, I want to be able to move the data in "G" to the cell beside "E" (up a row and over 4 columns) IF the cell to the left of "G" equals what I specify is in "F" (for example use "product"). I would want to apply this to an entire sheet, not just once. If the macro (not sure what its called) could also then delete the row that contained "G" after it moves it, that would be even better! The output in the example above would be:
ABCDEG
F HIJK
View 10 Replies
View Related
May 13, 2007
I am not so sure this can be done through a macro, but here is what I want.
I have a folder with say around 1000 excel workbooks. I need a macro to
1. Open each file in the directory specified
2. Read the contents of a particular cell, for ex, A1
3. Create a folder in the same directory with the value of A1
4. And, move the excel workbook itself to that folder.
5. Then it opens the next file
6. If the value of A1 is the same as that in the first workbook, it simply moves it to the already created folder, else it creates another folder with the new value of A1 and moves it there.
Hope I am not too confusing. Searching the forums does not give me an exact picture of how it can be done.
Note: I would also like an option where when I execute the macro, it should pop up with an option to select the folder in which the files are, since the files are not always saved in a static file path.
View 6 Replies
View Related
Mar 16, 2008
I download our monthly bank transactions (.csv). I have a workbook with sheets named for each creditor or expense.
I would like move each row, based on the specific word in a cell row, to the specific worksheet.
Here are some typical transactions in the Description column:
Some are specific:
1/7/2008ACH WEB-SINGLE 9085863 VONAGE AMERICA VONAGE
“Moved to the Vonage worksheet.”
Others are not so obvious:
2/1/2008CHECK CARD PURCHASE XXXXX4636 BOSTON MARKET #0450 GREENSBURG PA
“Moved to the Eat Out worksheet.”
2/21/2008CHECK CARD PURCHASE XXXXX4636 ASPCAPS XXXXX0028 MD
“Moved to the ASPCAPS worksheet.”
2/19/2007POS PURCHASE POS54309901 0014264 PITTSBURGH ST GREENSBURG PA
“Moved to the Grocery worksheet.”
I was able to find the following while during a Search:
Move Cells Containing Specific Word In Column To New Sheet
The question was answered, in addition to Dave Hawley, by Bill Rockenbach who inserted the following code - “Sub FindWord()”
Option Explicit
Sub FindWord()
Dim Sentences
Dim Word As String
Dim i As Long
Dim iWordPos As Integer
Dim lRow As Long
Dim sWord As String
If this is a possibility for what I'm looking for, I’m not sure how to implement it into my situation.
View 6 Replies
View Related
May 1, 2008
I need to CUT & PASTE records according a cell value. For example:
Columns A2 to AC1000 there are some values. In each rows of AD2:AD1000 the values repeats with the result something like "YES", "NO", "N.A.", "LESS CHANCE". So, I need to shift (to another sheet) only the entire rows with values of "NO" and "N.A."
View 6 Replies
View Related
Dec 19, 2013
I've been using the record macro function to accomplish a lot of my formatting tasks for my work reports.
I'm running into a snag that I'm not sure how to fix. Essentially I want the program to recognized the term "Grand Total" and the cell to the right of it. Then I want those two cells to be moved to the far left.
The # of rows will continuously change but he column shouldn't change.
I've tried naming the cell selection to have it moved but I can't seem to make it work.
When I use the record macro function and do a CTRL F search for "grand total", excel doesn't seem to recognize that I want that cell and the cell to the right to be the ones to move. Instead, whatever row of cells I create the macro with, it wants to duplicate the move with the same exact cell.
View 2 Replies
View Related
Mar 30, 2009
Below is my the macro that I recorded. I want to copy and paste the same information to a new location everytime. The macro tells it to go to cell IV1, end left, then I want it to go right one cell regardles of the cell location. Here it tells it to got to ("K1"). It will do this everytime and I do not want it to go to K1, just move right one time and then paste the information.
View 3 Replies
View Related