End (xlUp) Question

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
953
Office Version
  1. 2016
Platform
  1. Windows
Code:
For Each Cl In Range("C2", Range("C" & Rows.Count).End(xlUp))
   If Not IsError(Application.Match(Cl.Value, Columns(2), 0)) Then _
   Cl.EntireRow.Interior.ColorIndex = 28

The above code is working well. My question that I'm not entirely sure about, what "C2" is for?
I don't believe it to be Column 2, because that is already defined by Columns(2),0)).

Thanks for the help
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
this is saying go to the bottom of the spreadsheet in column C then come up again and select from C2 to the last used cell in column C Essencially C2:C? select
 
Last edited:
Upvote 0
It is a loop that uses an iteration of "C1"(not an advisable name) to walk through each cell between C2 and whatever the "Row.Count"(65k or 1 mill dependent on version of excel) up to the first cell with value in it.

If you have a match the entire row as defined in the iteration of "C1" will colored with index 28(light blue)
 
Upvote 0
this is saying go to the bottom of the spreadsheet in column C then come up again and select from C2 to the last used cell in column C Essencially C2:C? select

This is what I was thanking. If I use C3, the loop begins on C3?
Thanks
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,581
Members
449,174
Latest member
chandan4057

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