VBA - copy/paste entire row if row is highlighted

mgerner

New Member
Joined
Jun 16, 2018
Messages
5
I have a worksheet that has about 10,000 rows with data (the number of rows will vary though) , some of which are highlighted. I need to add a step to my macro that will search for the highlighted rows on one worksheet (sheet1) and paste them onto sheet2 starting in row1, which is completely blank. I can't seem to get anything I try to work. The color index is 8. Does anyone have any ideas?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How are the rows being highlighted?
 
Upvote 0
Is the whole row set to color index 8?
What do you do with the row once you have copied it?
 
Upvote 0
I'm using what's below to highlight the rows. After this step is where I need to add something that will take the highlighted rows from the "Prep" tab and paste them onto a new blank worksheet.

Code:
Dim LR As Long, i As Long
With Sheets ("Prep")
LR = .Range("A") & Rows.count).End(xlUp).Row
For i = LR To 1 Step -1
If IsNumeric(Application.Match(.Range("A" & i).Value, Sheets("Changes").Columns("A"), 0)) Then. Rows(i).Interior.ColorIndex = 8
Next i
End With
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...re-row-if-row-is-highlighted.html#post4926197

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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