View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steffen Sørdal Steffen Sørdal is offline
external usenet poster
 
Posts: 1
Default Beginner: Compare cells, if they have same value, then copy the ro

Hi,

I am newbie to VBA, and need help to accomplish:

In a sheet I need to compare the cells in row E (row E is sorted
alphabetically), to see if they have the same value. It can be up to 10 rows
with the same value. (the whole sheet contains <1500 rows)

If they are the same, those rows with samy value in column E shall be copied
to another sheet.
This is just a part of the makros that are running.

As said, I am a newbie, but does this do something?
(Earlier in the makro there is
Dim x
x = 1)

Sheets("Skatteseddel").Select

Dim k
k = 1

If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1
If Range("E" & x) = ("E" & "x + k") Then k = k + 1

Sheets("Skatteseddel").Select
Rows(x,x+k).Select
Selection.Copy

Can someone please help?

--
Regards,
Steffen
--
Regards,
Steffen