View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default NEED MACRO FOR COLOUR BY CONDITIONAL FORMATTING

from
NewShRowCount = 1
to
NewShRowCount = 2


"K" wrote:

Thanks Joel for replying. how can i amend your macro if i want macro
to copy data into next sheet from row 2 as i will be putting headings
in row 1. And also is there way i can get row copy from cell A to
cell F as with your macro its copying entire row.

Joel wrote:
Sub movedata()

OldShRowCount = 1
NewShRowCount = 1
With Sheets("OldSheet")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = _
.Range("D" & (OldShRowCount + 1))) And _
(.Range("E" & OldShRowCount) < _
.Range("E" & (OldShRowCount + 1))) Then

.Rows(OldShRowCount).Copy _
Destination:= _
Sheets("NewSheet").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With

End Sub


"K" wrote:

Hi, I have data in coloumn A to coloumn E. (please see below)
A B C
D E
000 B10 G628 000B10G628 54
000 B10 G628 000B10G628 53
000 B10 G628 000B10G628 53
000 B10 G628 000B10G628 53
000 B10 000B10 12
000 B10 000B10 13
000 B10 000B10 12
000 B10 000B10 12
in coloumn D i have Formula which is "=A1&B1&C1" as you can see above
and then I put
CONDITIONAL FORMATTING in coloumn D as well in which I put the Formula
which is
"=IF(AND(D2=D3,E2<E3),TRUE)" its mean that if two values in coloumn D
cells are equal but two values in coloumn E are not equal which are
against each other in same cells then its true and the Cell should
get Red colour. so when ever two values in coloumn D are equal but in
next coloumn E the two values are not equal cell get Red colour by
CONDITIONAL FORMATTING.I want MACRO which can copy only those rows in
which coloumn D cells have Red colour to next sheet. Please Note that
cells getting Red colours by CONDITIONAL FORMATTING and whole coloumn
D have CONDITIONAL FORMATTING. Some friend send me macro but it copy
all data to next sheet instead of just coping only those rows in which
coloumn D cells have Red colour by CONDITIONAL FORMATTING. Please if
anybody can help. Thanks