I need to find color cell, cut the range and paste them into another sheet

michellin

Board Regular
Joined
Oct 4, 2011
Messages
56
Office Version
  1. 2019
Platform
  1. Windows
Hi there,

I start a Macro but i need help.

My needs :

find all yellow cell (color#6) in column A from sheet1,
then cut all the line (A:M) or entire row when in found in a cell yellow #6,
to the sheet2 from range a2 (range a1 is my title) going down without erasing the last line,
and circle them all.
And add more next day on the next line. like it starting to the last unused range, to never erase full line
And make sure the cell format is coming with it.

I got this, but is stopping after only one cut, how i can fix it to go down till range 1001 max or entire sheet.

Sub Cutcolor()

With Selection.Font
.Color = 6
.TintAndShade = 0
End With

Selection.EntireRow.Copy Sheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1)
Selection.EntireRow.Delete xlShiftUp

End Sub

That macro work, but stop after the first line, i need to run it multiple time, and sometimes it cut none coloring range.

Im using on sheet1, column from A to M, range a1 is title, so range 2 to 1001

in bonus if thats exist, i would love to get the date at the end of the copied line in column N. fonction now or today.

I hope i'm clear, sorry for my bad english, i know the forum get another language page, but the best are here.

Thanks for your help, i really try a lot by myself, and reseach here and internet. But i'm a noob...

i'm pretty sure it would be super easy for you.

Thanks a lot guys or girl, thanks a lot people :cool:

Michellin
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hello I couldn't solve your interest for circling the row but rest I think I managed to solve. Please try this. and do share your feedback
VBA Code:
Sub moving_todiff_sheet()
    Dim i As Integer
    Dim j As Integer
    j = 2
    For i = 2 To 1001
        If Range("a" & i).Interior.color = vbYellow Then
            Range("a" & i).EntireRow.Copy Worksheets(2).Range("a" & j)
            Range("a" & i).EntireRow.Delete
            i = i - 1
            j = j + 1
        End If
    Next i
End Sub
 
Upvote 0
Hi er_neha

Thats work great, it moving every yellow one to the other sheet.

The only thing that bug, it if i run it a second time, the macro overwrite, and restart on line 2.

It why i was starting utilising offset to make sure, he find the last row+1 and write the next row on the last blank row.

Thanks a lot
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,834
Members
449,192
Latest member
mcgeeaudrey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top