cut & copy line...

  • Thread starter Thread starter sal21
  • Start date Start date
S

sal21

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
 
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
 
rick_deacha said:
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
 
Back
Top