VBA Code To Move Row From One Worksheet To Another
Mar 28, 2014
I created a outstanding task worksheet in excel and I would like to move the completed jobs from this sheet to the second worksheet titled 'Completed Tasks'. The first worksheet is called 'Outstanding Tasks'.
I came up with a code to do this (see below). As you can see when I type "Y" into column G it moves the row into the second worksheet. It does this; however it puts it to the bottom of the table on the second worksheet where I would like it to be at the top. I also would like it to delete the row once it has moved it does this but then deletes the other row of information above it leaving blank rows on either side.
I simply want a code that moves the row of information to the second worksheet when I type Y into column G and then delete the row without messing with other information around it.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim rng As Range
Set rng = Target.Parent.Range("G5:G1000")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
Select Case Target.Text
Case "Y"
Target.EntireRow.Cut Sheets("Completed Tasks").Cells(Rows.Count, "A").End(xlUp).Offset(1)
Selection.ListObject.ListRows(1).Delete
End Select
End Sub
View 1 Replies
ADVERTISEMENT
Mar 17, 2012
I need a code that will allow me to move data from a worksheet to a worksheet from which I came from. e.g. worksheet "Sheet 6" opens "Sheet 10", then after filling data in "Sheet 10" I need to move this data back to "Sheet 6" in the cells in range "F12 to F56". Please note that the data in "Sheet 10" is in the same range as in "Sheet 6"
View 1 Replies
View Related
Jan 15, 2010
I have a Excel workbook with two sheets - 'MainDataSheet' and 'ArchiveSheet' .
The 'MainDataSheet' has 5 columns and one of the column is 'status'.
The 'MainDataSheet' will have a command button 'MoveData' which will trigger the VBA macro to move data rows from 'MainDataSheet' to 'ArchiveSheet' . Only the rows having value set to "MOVE" in the 'status' column have to be moved.
View 9 Replies
View Related
Mar 7, 2014
I could get a code to move a row from one area of a worksheet to another area on the same worksheet once a cell is tagged "Paid" via a refreshed macro. The updating data table starts on Row 3 for columns "B" - "R." The paid table starts on row 56 where column "B" always has a date in its cell.
View 7 Replies
View Related
Jan 15, 2007
the code to get my cursor to move down 1 row or cell without it actually referencing the chosen cell.
View 9 Replies
View Related
Feb 15, 2007
Is there a code to make the Cursor Movement direction to be set to move Left ?
View 2 Replies
View Related
Sep 3, 2013
I have a list of file names in Excel and I need to move the files from one folder into another. Sometimes I'm having to find and move hundreds of files into different destination folders, hence why I would like a macro. My spreadsheet will be something like:
Column A
Column B
Column C
Row 1
File name
[Code]...
View 3 Replies
View Related
Dec 10, 2008
I searched and found a couple of different active.sheet codes but could not get it to work. What I want to do is move the worksheet tab I create in the code below all the way to the end (right) of the worksheet tabs already in my workbook.
View 2 Replies
View Related
Feb 26, 2014
Right now I am at Column D; From E to I columns are hidden in my worksheet and would like to move to Column J.
View 7 Replies
View Related
Feb 25, 2009
I have a small problem that is more annoying than anything else. I have a command button that opens a userform, and the user can select a value and 'OK'. On 'OK', the code runs, however I would like the sheet 'Information' to remain visible until the code finishes and then switch to 'Task Intervals'. There is also a lot of screen flicker, despite selecting it off/on. I have included an Example file so that you can see the problem.
View 3 Replies
View Related
Oct 12, 2011
coding that will select whatever data is entered in say Coulmn D & then copy it to the botom of another list in Column F.
The amount of rows with data in any of the colums may vary.
View 8 Replies
View Related
Jun 2, 2013
I have this code that removes a group of cells on any row that contains "Y" in Column L, but it does not move the remaining group of cells on a row up after the cells are deleted.
VB code so that when a range of cells are deleted, the row(s) below are moved up?
Sub RemoveReceived()
LastRow = Cells(Rows.Count, "H").End(xlUp).Row 'change "H" to the column that determines which is the last row
For x = LastRow To 4 Step -1 'assuming it starts from row 4
If Cells(x, "L") = "Y" Then
Range("H" & x & ":K" & x).ClearContents ' or use Delete
[Code] ........
View 2 Replies
View Related
May 8, 2009
I would like to copy or move data from one worksheet to another automatically. I have one sheet (Data) with multiple pieces of data for specific individuals. I have several other sheets titled their last name. Can data for example from John Doe be copied to the sheet Doe and data for John Smith be copied to sheet Smith. In essence I would like the sheet to paste everything below John Doe to Doe's sheet and recognize the next name and past that into the next sheet and so on. It may be several different codes, Im ok with that.
One other item all cells do not have data I do need the blank cells copied as well at to not lose the formatting. There is also a blank 2 rows between each person.
If you need a copy of what the data looks like I can send it.
View 9 Replies
View Related
Apr 28, 2007
I want play a trick on someone and make a button move out of the way when they try to click on it. I think that this code is from VB6.0:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
CommandButton1.Move Rnd(100) * 4000, Rnd(100) * 4000, 1000, 1000
End Sub
In Excel, this code results in Run-time error '438': "Object doesn't support this property or method."
Is there a way to "move" a button in Excel VBA?
View 3 Replies
View Related
Jun 4, 2008
I need to be able to move pagebreaks in Excel by means of VBA.
I have found an example in Excel Help (see below), but it doesn't work.
Sheets("Sheet1").HPageBreaks(1).Location = Sheets("Sheet1"). Range("A24")
View 9 Replies
View Related
Apr 16, 2014
Move a row of work to resolved tab once column M is changed to resolved This needs to be moved to the first available line on the resolve tab The row that has just been moved from the orginating agents tab needs to be deleted and shifted up When moved to the resolved tab I want it to prepopulate where the row originated from in column N When moved to resolved tab I want it to prepopulate the date it was resolved Also the spreadsheet will be shared
I have attached a test version of the spreadsheet.
View 2 Replies
View Related
Aug 26, 2008
I have whats going to be a very large "Input" worksheet that has several headings of columns. One of these columns is "category" as in parts of a vehicle, i.e. steering, wheels, rod-ends and so on. Now what I would like to do, is once I type a new row of information in, to have the filter go through and copy said category row into another worksheet where I can have all of them separated on there own.
Here is a picture of my current spreadsheet. So basically I want to be able once I save the file, that it goes through and where it detects Rear-End in "B18" I would like it to select row 18, copy all of its cells and move them into the worksheet Rear-End
View 14 Replies
View Related
Sep 16, 2008
I have a workbook with two worksheets in it. The first "TO DO" and the second "Completed". In "TO DO", I have rows of tasks starting in row 4 (row 3 is my header), going to 200. What I'd like to have happen is when I put a "C" in column C, it moves the entire row to the "Completed" worksheet, greys it out and removes it from the "TO DO" worksheet. Then if I remove the "C" from the "Completed" worksheet, it moves it back to the bottom of the list. I already have a macro to resort it based on "priority" in column E.
View 9 Replies
View Related
Nov 2, 2008
i need to get certain info from one worksheet to another is there any way to do this automatically
View 9 Replies
View Related
Oct 7, 2009
i have this at the moment:
in a sheet named CURRENT is all our data.
when the jobs done the Satus Column "F" is changed to INVOICE
and then once a day or whenever they are all moved to a new sheet named the month and year, in this case JUN 09 this works fine as it is but at the moment i have to delete the lines myself from where it took the data from in CURRENT or AtoZ then remove them in 1 go.
Simply put, i want the code to remove these lines itself....
View 9 Replies
View Related
Aug 16, 2008
I have a set of worksheets that need to be moved to their own individual master sheets. i.e. FW32Lightning.csv needs to be moved to Lightning.xls which has all of the fiscal weeks in it as seperate. I know the generic way of doing this, but I need to know how do I write the macro that when I run it every week I don't have to go in and change the fiscal week.
View 5 Replies
View Related
Apr 22, 2006
I've included bits of my code and some debug output. Whenever I attempt to add a worksheet, either BEFORE or AFTER I get the following ERROR MESSAGE: Method 'Add' of object 'Sheets' Failed. if I use the .add without before and after a worksheet is added. The problem is that it is always added before the active sheet. I need to replace a single sheet in the correct position of possible 10 sheets. I know the names of the sheets and which one I want to replace, but I can't get EXCEL to move sheets, add sheets by position Number or name, without getting the ERROR.
Public xlApp As Excel.Application
Public xlBook As Excel.Workbook
Public xlSheet As Excel.Worksheet
Public xlRange As Excel.Range
.....
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
....
xlBook.Worksheets.Add After:="Accounts Receivable" *****
?xlsheet.Name
Accounts Receivable
?xlbook.Worksheets.Count
4
?xlbook.Worksheets(4).name
Accounts Receivable
View 2 Replies
View Related
Jul 27, 2006
How can I move data from one worksheet and place in another worksheet in the appropriate column? I exported data from Access to Excel in order but I need to group the data in excel.
View 3 Replies
View Related
Nov 28, 2006
With the above code, is it possible to trasfer all selected charts, on to a new spreadsheet and print them to fit on one page Landscape, no margins?? Or is that stretching it, i tried it but i print them all A4
View 2 Replies
View Related
Oct 25, 2007
I have a workbook with multiple sheets. I need to create a macro and associate it with a command button that will cut the row the user has selected and paste it into the last empty row on another sheet in the same workbook, then, go back to the first sheet and delete the empty row.
View 3 Replies
View Related
Apr 18, 2014
I have 'sheet 1' (data collection sheet) and 'sheet 2' (form filling sheet)
I've recorded a macro which sends data from 'sheet 2' to 'sheet 1' (linked to a submit button on 'sheet 2')
I want the macro to allow the next form filled information to be transferred onto the next line down on 'sheet 1'.
The current code is:
[Code] ......
View 4 Replies
View Related
Jul 2, 2013
I have created a few macros and once I was happy that they worked independently I joined them to run as one macro in several steps. I have just discovered a bug ...
The macro filters on a column and copies and pastes that range into another sheet.
HOwever, sometimes (as I have just discovered) when it filters, there will be no data against the value it is looking for.
I need to say, if no value, move to next step.
I.e. here's my code. It's looking for ASIA and it will copy and paste all rows with Asia to another page. It then does the same for EMEA. Thing is, in my example just now, there was no EMEA data and some times there may be no ASIA data so I need to build in some rules that if it does not find either of these it continues to finish macro or pops up and says 'NO ASIA found, CLick to continue' or something?
Selection.AutoFilter
ActiveSheet.Range("$A$12:AA" & lngLast).AutoFilter Field:=27, Criteria1:="ASIA"
Range("A13:Z" & lngLast).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("ASIA DETAIL ").Select
Range("A19").Select
[code]...
View 1 Replies
View Related
Oct 18, 2007
I'm trying to move my VBA programming to the next level and use more efficient code.
I'm wondering if there is a faster way to run the loop below, perhaps removing the 'For c = 2 to LastRow' as it seems a little clunky to me.
For c = 2 to LastRow
If Cells(c, Range("Product_Type").Column) = "" Then _
Cells(c, Range("Product_Type").Column).Interior.ColorIndex = 41
Next c
I've seen a similar thing somewhere where it was all done in one statement without the loop.
View 9 Replies
View Related
May 11, 2009
I want code to move the cursor to A788
But keep A788 in the top left corner on screen.
Is there easy code to help me accomplish this?
Also, Is there code that will take you to the first cell it finds closest to today's date.
Dates are in Column B.g
View 9 Replies
View Related
Sep 8, 2006
I have to issue template workbooks to people for budgeting purposes.
Within the workbooks are various numbers of worksheets pre -formatted and ready for these people to enter data.
Some of the data in the worksheets is important to them as individuals but not to me so I have a series of macros that lift the information from the worksheets and put it into a worksheet more specific to me.
Because the users are on the whole not that good with Excel I have put in easy to use look up tables and various proctections to stop them adding or deleting rows or columns as this plays havoc with my macros.
There is one thing I have "so far" been unable to do and I wondered if anyone could help.
Is there a macro that I could put somewhere in the workbook which would detect when someone tried to cut and paste and would either put up a message box or stop them doing this?
The reason being they are cutting from one row to another and this is messing up the calculations which are protected.
Is there also a way to stop them changing the name on the sheet tab in the smae way?
View 9 Replies
View Related