ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy rows to next sheet (https://www.excelbanter.com/excel-programming/402800-copy-rows-next-sheet.html)

K[_2_]

copy rows to next sheet
 
is there any macro that if i want to copy only those rows (row lentgh
cell A to cell F) from sheet 1 to sheet 2 in which any cell in coloumn
B got Red colour by conditional formatting. Please just need the
macro if anybody can help. thanks

JLGWhiz

copy rows to next sheet
 
Check your original posting.

"K" wrote:

is there any macro that if i want to copy only those rows (row lentgh
cell A to cell F) from sheet 1 to sheet 2 in which any cell in coloumn
B got Red colour by conditional formatting. Please just need the
macro if anybody can help. thanks


JLGWhiz

copy rows to next sheet
 
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:

is there any macro that if i want to copy only those rows (row lentgh
cell A to cell F) from sheet 1 to sheet 2 in which any cell in coloumn
B got Red colour by conditional formatting. Please just need the
macro if anybody can help. thanks


K[_2_]

copy rows to next sheet
 
On 15 Dec, 18:31, JLGWhiz wrote:
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:
is there any macro that if i want to copy only those rows (row lentgh
cell A to cell F) from sheet 1 to sheet 2 in which any cell in coloumn
B got Red colour by conditional formatting. Please just need the
macro if anybody can help. thanks- Hide quoted text -


- Show quoted text -


Thanks JLG


All times are GMT +1. The time now is 12:11 PM.

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