ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cut & copy line... (https://www.excelbanter.com/excel-programming/292417-cut-copy-line.html)

sal21[_13_]

cut & copy line...
 
i have a wbook with 2 sheets.
sheet1 and sheet2.
in every sheets are many data.
the range of column A3 : P30000 is the same range for every sheets.

my problem is:

Make a vlookup in sheet1 A3:A30000 from sheet2 A3:A30000, if the value
is finded in this range cut the relative line, and copy the entire line
in the shett3 start the copy of lines from A3, rearrange the sheet...
with no blank line


---
Message posted from http://www.ExcelForum.com/


rick_deacha[_2_]

cut & copy line...
 
try this sal21



Code:
--------------------

Dim i, count as long

Sub YourMacro()
count=3
For i=3 to 3000
If Sheets("sheet1").cells(i,1).value=Sheets("sheet2") .cells(i,1).value then
Sheets("sheet1").Select
Rows(i & ":" & i).select
Selection.Copy
Sheets("Sheet3").Select
Rows(count & ":" & count).Select
ActiveSheet.Paste
count=count+1
End if
Next
End Sub

--------------------



It will work. good luck


---
Message posted from http://www.ExcelForum.com/


sal21[_14_]

cut & copy line...
 
rick_deacha wrote:
try this sal21



Code
-------------------

Dim i, count as long

Sub YourMacro()
count=3
For i=3 to 3000
If Sheets("sheet1").cells(i,1).value=Sheets("sheet2") .cells(i,1).value And Sheets("sheet1").cells(i,1).value < "" then
Sheets("sheet1").Select
Rows(i & ":" & i).select
Selection.Copy
Sheets("Sheet3").Select
Rows(count & ":" & count).Select
ActiveSheet.Paste
count=count+1
End if
Next
End Sub

-------------------



It will work. good luck


HOW! it work fine. But for this macro my idea is to delete the cute
line... and reaarrange the relative sheet with no blank lines... i
possible


--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com