PC Review


Reply
Thread Tools Rate Thread

copy rows based on cell colour by conditional formating

 
 
K
Guest
Posts: n/a
 
      15th Dec 2007
Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
by conditional formatting. I have put formula in conditional
formatting that when if value of cell in coloumn B is True by formula
then cell get Red colour. One of my online friend send me the macro
(please see below) which work fine but little problem that instead of
coping only Red coloured cells by conditional formatting it copies all
sheet1 data to sheet2. I want macro to copy only those cells rows
which got Red colour by conditional formatting. and i dont want
entire row just from cell A to cell F. Please any body can help as i
am doing project for my job and this will be very helpful. " I know
that there are lot of my friends out there are very good in macros"
Please help. Thanks..........

Sub cpyColr()
Dim c As Range
lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
For Each c In Worksheets(1).Range("B2:B" & lastRw)
If c.FormatConditions(1).Interior.ColorIndex = 3 Then
lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
cRng = c.Address
Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
Range(cRng).Row).Copy _
Worksheets(2).Range("A" & lstRw2 + 1)
End If
Next
End Sub


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      15th Dec 2007
See website below. You can't directly view the color set by conditional
formating. You have to get the setting of the conditional formating and
recalculate the formula in Condittional formating using VBA.


http://www.cpearson.com/excel/CFColors.htm


"K" wrote:

> Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> by conditional formatting. I have put formula in conditional
> formatting that when if value of cell in coloumn B is True by formula
> then cell get Red colour. One of my online friend send me the macro
> (please see below) which work fine but little problem that instead of
> coping only Red coloured cells by conditional formatting it copies all
> sheet1 data to sheet2. I want macro to copy only those cells rows
> which got Red colour by conditional formatting. and i dont want
> entire row just from cell A to cell F. Please any body can help as i
> am doing project for my job and this will be very helpful. " I know
> that there are lot of my friends out there are very good in macros"
> Please help. Thanks..........
>
> Sub cpyColr()
> Dim c As Range
> lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> For Each c In Worksheets(1).Range("B2:B" & lastRw)
> If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> cRng = c.Address
> Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> Range(cRng).Row).Copy _
> Worksheets(2).Range("A" & lstRw2 + 1)
> End If
> Next
> End Sub
>
>
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      15th Dec 2007
Hi K

With EasyFilter you can also do this
http://www.rondebruin.nl/easyfilter.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"K" <(E-Mail Removed)> wrote in message news:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> by conditional formatting. I have put formula in conditional
> formatting that when if value of cell in coloumn B is True by formula
> then cell get Red colour. One of my online friend send me the macro
> (please see below) which work fine but little problem that instead of
> coping only Red coloured cells by conditional formatting it copies all
> sheet1 data to sheet2. I want macro to copy only those cells rows
> which got Red colour by conditional formatting. and i dont want
> entire row just from cell A to cell F. Please any body can help as i
> am doing project for my job and this will be very helpful. " I know
> that there are lot of my friends out there are very good in macros"
> Please help. Thanks..........
>
> Sub cpyColr()
> Dim c As Range
> lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> For Each c In Worksheets(1).Range("B2:B" & lastRw)
> If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> cRng = c.Address
> Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> Range(cRng).Row).Copy _
> Worksheets(2).Range("A" & lstRw2 + 1)
> End If
> Next
> End Sub
>
>

 
Reply With Quote
 
K
Guest
Posts: n/a
 
      15th Dec 2007
is there any macro for this

Ron de Bruin wrote:
> Hi K
>
> With EasyFilter you can also do this
> http://www.rondebruin.nl/easyfilter.htm
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "K" <(E-Mail Removed)> wrote in message news:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > by conditional formatting. I have put formula in conditional
> > formatting that when if value of cell in coloumn B is True by formula
> > then cell get Red colour. One of my online friend send me the macro
> > (please see below) which work fine but little problem that instead of
> > coping only Red coloured cells by conditional formatting it copies all
> > sheet1 data to sheet2. I want macro to copy only those cells rows
> > which got Red colour by conditional formatting. and i dont want
> > entire row just from cell A to cell F. Please any body can help as i
> > am doing project for my job and this will be very helpful. " I know
> > that there are lot of my friends out there are very good in macros"
> > Please help. Thanks..........
> >
> > Sub cpyColr()
> > Dim c As Range
> > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > cRng = c.Address
> > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > Range(cRng).Row).Copy _
> > Worksheets(2).Range("A" & lstRw2 + 1)
> > End If
> > Next
> > End Sub
> >
> >

 
Reply With Quote
 
K
Guest
Posts: n/a
 
      15th Dec 2007
Thanks for recomendings but as there will be more people using my
spreadsheet and a macro will do much help for me. Please if any body
can find a macro for me thanks

K wrote:
> is there any macro for this
>
> Ron de Bruin wrote:
> > Hi K
> >
> > With EasyFilter you can also do this
> > http://www.rondebruin.nl/easyfilter.htm
> >
> >
> > --
> >
> > Regards Ron de Bruin
> > http://www.rondebruin.nl/tips.htm
> >
> >
> > "K" <(E-Mail Removed)> wrote in message news:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > > by conditional formatting. I have put formula in conditional
> > > formatting that when if value of cell in coloumn B is True by formula
> > > then cell get Red colour. One of my online friend send me the macro
> > > (please see below) which work fine but little problem that instead of
> > > coping only Red coloured cells by conditional formatting it copies all
> > > sheet1 data to sheet2. I want macro to copy only those cells rows
> > > which got Red colour by conditional formatting. and i dont want
> > > entire row just from cell A to cell F. Please any body can help as i
> > > am doing project for my job and this will be very helpful. " I know
> > > that there are lot of my friends out there are very good in macros"
> > > Please help. Thanks..........
> > >
> > > Sub cpyColr()
> > > Dim c As Range
> > > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > > cRng = c.Address
> > > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > > Range(cRng).Row).Copy _
> > > Worksheets(2).Range("A" & lstRw2 + 1)
> > > End If
> > > Next
> > > End Sub
> > >
> > >

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      15th Dec 2007
Here is a modified version that should only select those rows that have
conditional format with interior color = red.

"K" wrote:

> Thanks for recomendings but as there will be more people using my
> spreadsheet and a macro will do much help for me. Please if any body
> can find a macro for me thanks
>
> K wrote:
> > is there any macro for this
> >
> > Ron de Bruin wrote:
> > > Hi K
> > >
> > > With EasyFilter you can also do this
> > > http://www.rondebruin.nl/easyfilter.htm
> > >
> > >
> > > --
> > >
> > > Regards Ron de Bruin
> > > http://www.rondebruin.nl/tips.htm
> > >
> > >
> > > "K" <(E-Mail Removed)> wrote in message news:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > > > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > > > by conditional formatting. I have put formula in conditional
> > > > formatting that when if value of cell in coloumn B is True by formula
> > > > then cell get Red colour. One of my online friend send me the macro
> > > > (please see below) which work fine but little problem that instead of
> > > > coping only Red coloured cells by conditional formatting it copies all
> > > > sheet1 data to sheet2. I want macro to copy only those cells rows
> > > > which got Red colour by conditional formatting. and i dont want
> > > > entire row just from cell A to cell F. Please any body can help as i
> > > > am doing project for my job and this will be very helpful. " I know
> > > > that there are lot of my friends out there are very good in macros"
> > > > Please help. Thanks..........
> > > >
> > > > Sub cpyColr()
> > > > Dim c As Range
> > > > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > > > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > > > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > > > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > > > cRng = c.Address
> > > > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > > > Range(cRng).Row).Copy _
> > > > Worksheets(2).Range("A" & lstRw2 + 1)
> > > > End If
> > > > Next
> > > > End Sub
> > > >
> > > >

>

 
Reply With Quote
 
K
Guest
Posts: n/a
 
      15th Dec 2007
On 15 Dec, 16:51, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Here is a modified version that should only select those rows that have
> conditional format with interior color = red.
>
>
>
> "K" wrote:
> > Thanks for recomendings but as there will be more people using my
> > spreadsheet and a macro will do much help for me. Please if any body
> > can find a macro for me thanks

>
> > K wrote:
> > > is there any macro for this

>
> > > Ron de Bruin wrote:
> > > > Hi K

>
> > > > With EasyFilter you can also do this
> > > >http://www.rondebruin.nl/easyfilter.htm

>
> > > > --

>
> > > > Regards Ron de Bruin
> > > >http://www.rondebruin.nl/tips.htm

>
> > > > "K" <kamranr1...@yahoo.co.uk> wrote in messagenews:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > > > > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > > > > by conditional formatting. I have put formula in conditional
> > > > > formatting that when if value of cell in coloumn B is True by formula
> > > > > then cell get Red colour. One of my online friend send me the macro
> > > > > (please see below) which work fine but little problem that instead of
> > > > > coping only Red coloured cells by conditional formatting it copies all
> > > > > sheet1 data to sheet2. I want macro to copy only those cells rows
> > > > > which got Red colour by conditional formatting. and i dont want
> > > > > entire row just from cell A to cell F. Please any body can help as i
> > > > > am doing project for my job and this will be very helpful. " I know
> > > > > that there are lot of my friends out there are very good in macros"
> > > > > Please help. Thanks..........

>
> > > > > Sub cpyColr()
> > > > > Dim c As Range
> > > > > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > > > > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > > > > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > > > > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > > > > cRng = c.Address
> > > > > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > > > > Range(cRng).Row).Copy _
> > > > > Worksheets(2).Range("A" & lstRw2 + 1)
> > > > > End If
> > > > > Next
> > > > > End Sub- Hide quoted text -

>
> - Show quoted text -


Hi JLG, please state the macro thanks
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      15th Dec 2007
Sorry about that:

Sub cpyColr()
Dim c As Range
lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
For Each c In Worksheets(1).Range("B2:B" & lastRw)
If c.FormatConditions.Count > 0 Then
If c.FormatConditions(1).Interior.ColorIndex = 3 Then
lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
cRng = c.Address
Worksheets(1).Range("A" & Range(cRng).Row & ":F" & _
Range(cRng).Row).Copy Worksheets(2).Range("A" & lstRw2 + 1)
End If
End If
Next
End Sub


"K" wrote:

> On 15 Dec, 16:51, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > Here is a modified version that should only select those rows that have
> > conditional format with interior color = red.
> >
> >
> >
> > "K" wrote:
> > > Thanks for recomendings but as there will be more people using my
> > > spreadsheet and a macro will do much help for me. Please if any body
> > > can find a macro for me thanks

> >
> > > K wrote:
> > > > is there any macro for this

> >
> > > > Ron de Bruin wrote:
> > > > > Hi K

> >
> > > > > With EasyFilter you can also do this
> > > > >http://www.rondebruin.nl/easyfilter.htm

> >
> > > > > --

> >
> > > > > Regards Ron de Bruin
> > > > >http://www.rondebruin.nl/tips.htm

> >
> > > > > "K" <kamranr1...@yahoo.co.uk> wrote in messagenews:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > > > > > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > > > > > by conditional formatting. I have put formula in conditional
> > > > > > formatting that when if value of cell in coloumn B is True by formula
> > > > > > then cell get Red colour. One of my online friend send me the macro
> > > > > > (please see below) which work fine but little problem that instead of
> > > > > > coping only Red coloured cells by conditional formatting it copies all
> > > > > > sheet1 data to sheet2. I want macro to copy only those cells rows
> > > > > > which got Red colour by conditional formatting. and i dont want
> > > > > > entire row just from cell A to cell F. Please any body can help as i
> > > > > > am doing project for my job and this will be very helpful. " I know
> > > > > > that there are lot of my friends out there are very good in macros"
> > > > > > Please help. Thanks..........

> >
> > > > > > Sub cpyColr()
> > > > > > Dim c As Range
> > > > > > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > > > > > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > > > > > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > > > > > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > > > > > cRng = c.Address
> > > > > > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > > > > > Range(cRng).Row).Copy _
> > > > > > Worksheets(2).Range("A" & lstRw2 + 1)
> > > > > > End If
> > > > > > Next
> > > > > > End Sub- Hide quoted text -

> >
> > - Show quoted text -

>
> Hi JLG, please state the macro thanks
>

 
Reply With Quote
 
K
Guest
Posts: n/a
 
      15th Dec 2007
On 15 Dec, 18:29, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Sorry about that:
>
> Sub cpyColr()
> Dim c As Range
> lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> For Each c In Worksheets(1).Range("B2:B" & lastRw)
> If c.FormatConditions.Count > 0 Then
> If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> cRng = c.Address
> Worksheets(1).Range("A" & Range(cRng).Row & ":F" & _
> Range(cRng).Row).Copy Worksheets(2).Range("A" & lstRw2 + 1)
> End If
> End If
> Next
> End Sub
>
>
>
> "K" wrote:
> > On 15 Dec, 16:51, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > > Here is a modified version that should only select those rows that have
> > > conditional format with interior color = red.

>
> > > "K" wrote:
> > > > Thanks for recomendings but as there will be more people using my
> > > > spreadsheet and a macro will do much help for me. Please if any body
> > > > can find a macro for me thanks

>
> > > > K wrote:
> > > > > is there any macro for this

>
> > > > > Ron de Bruin wrote:
> > > > > > Hi K

>
> > > > > > With EasyFilter you can also do this
> > > > > >http://www.rondebruin.nl/easyfilter.htm

>
> > > > > > --

>
> > > > > > Regards Ron de Bruin
> > > > > >http://www.rondebruin.nl/tips.htm

>
> > > > > > "K" <kamranr1...@yahoo.co.uk> wrote in messagenews:e74e6e23-fe47-4a10-8228-(E-Mail Removed)...
> > > > > > > Hi, i get "Interior.Colorindex = 3" or Red colour in coloumn B cells
> > > > > > > by conditional formatting. I have put formula in conditional
> > > > > > > formatting that when if value of cell in coloumn B is True by formula
> > > > > > > then cell get Red colour. One of my online friend send me the macro
> > > > > > > (please see below) which work fine but little problem that instead of
> > > > > > > coping only Red coloured cells by conditional formatting it copies all
> > > > > > > sheet1 data to sheet2. I want macro to copy only those cells rows
> > > > > > > which got Red colour by conditional formatting. and i dont want
> > > > > > > entire row just from cell A to cell F. Please any body can help as i
> > > > > > > am doing project for my job and this will be very helpful. " I know
> > > > > > > that there are lot of my friends out there are very good in macros"
> > > > > > > Please help. Thanks..........

>
> > > > > > > Sub cpyColr()
> > > > > > > Dim c As Range
> > > > > > > lastRw = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> > > > > > > For Each c In Worksheets(1).Range("B2:B" & lastRw)
> > > > > > > If c.FormatConditions(1).Interior.ColorIndex = 3 Then
> > > > > > > lstRw2 = Worksheets(2).Range("A65536").End(xlUp).Row
> > > > > > > cRng = c.Address
> > > > > > > Worksheets(1).Range("A" & Range(cRng).Row & ":F" &
> > > > > > > Range(cRng).Row).Copy _
> > > > > > > Worksheets(2).Range("A" & lstRw2 + 1)
> > > > > > > End If
> > > > > > > Next
> > > > > > > End Sub- Hide quoted text -

>
> > > - Show quoted text -

>
> > Hi JLG, please state the macro thanks- Hide quoted text -

>
> - Show quoted text -


Thanks you very much JLG & Ron. You guys are very good in macros
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows based on cell colour K Microsoft Excel Programming 4 15th Dec 2007 06:25 PM
copy rows based on cell colour K Microsoft Excel Programming 1 13th Dec 2007 11:04 PM
Re: Conditional Formating based on a different cell Gord Dibben Microsoft Excel Misc 0 9th Dec 2006 09:18 PM
Re: Conditional Formating based on a different cell SteveW Microsoft Excel Misc 0 9th Dec 2006 08:57 PM
Conditional Formating based on another cell =?Utf-8?B?U01hYw==?= Microsoft Excel Misc 5 10th Mar 2005 07:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:23 AM.