Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
move row from one sheet to another
I'm creating an excel template for a company. On the first sheet I need a list of items and their descriptions, and I need to have a way to select only certain items and then move those entire rows of the items and their descriptions to sheet 2. Do you have any ideas on how I could go about doing this? I'm really stuck!!!!!!!!!!!
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
move row from one sheet to another
Something like this :-
'--------------------------------------------------------- Sub transfer_data() Dim FromSheet As Worksheet Dim ToSheet As Worksheet Dim FromRow As Long Dim ToRow As Long Dim LastRow As Long Dim FindValue '-------------------------- Application.Calculation = xlCalculationManual Set FromSheet = ActiveSheet Set ToSheet = Workbooks("Book1.xls").Worksheets("data") LastRow = ToSheet.Range("A65536").End(xlUp).Row + 1 FromRow = 2 While FromSheet.Cells(FromRow, 1).Value < "" FindValue = FromSheet.Cells(FromRow, 1).Value '- check for transfer or not If FindValue 10 Then FromSheet.Range("A" & FromRow & ":H" & FromRow).Copy ToSheet.Paste Destination:=ToSheet.Range("A" & LastRow) LastRow = LastRow + 1 '- delete row FromSheet.Rows(FromRow).EntireRow.Delete Else FromRow = FromRow + 1 End If Wend Application.Calculation = xlCalculationAutomatic MsgBox ("Done") End Sub '--------------------------------------------------------------- -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to move rows from one sheet to another sheet (macro) | Excel Discussion (Misc queries) | |||
Creating form on sheet 1 and having info move to sheet 2 | Excel Discussion (Misc queries) | |||
How do I move daily data from one sheet to a 'yearly sheet' | Excel Worksheet Functions | |||
Move data to new sheet - rename sheet based on criteria ? | Excel Discussion (Misc queries) | |||
move rows of data seperated in a sheet to a sheet with no separat | Excel Worksheet Functions |