+ Reply to Thread
Results 1 to 5 of 5

meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

  1. #1
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    447

    meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

    Hi,

    Does someone know what this line of code exactly means?

    Please Login or Register  to view this content.
    It selects the filled cells in a row. But i don't understand the sequence of steps.

    All input is much appreciated!

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

    It selects the active range in column C. It does this by identifying the last row in column C by this piece of code

    Cells(Rows.Count, 2).End(xlUp).Row)
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    447

    Re: meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

    Thank you for the explanation

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

    identifying the last row in column B by this piece of code
    So C2 to last row represented in Column B

    Please Login or Register  to view this content.
    Last edited by Sintek; 06-20-2020 at 05:52 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: meaning of range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row).Select

    Good pick up.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Count number of rows in a range that contain less than 5 cells with the string "VAC"
    By bananius in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-25-2014, 03:58 PM
  2. [SOLVED] VBA "& Cells(Rows.Count)" problem - copying outside of range
    By Dgp2012 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2014, 05:18 AM
  3. range("e1" & cells(rows.Count,5).end(xlup)).Select
    By sohaila in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2014, 09:27 AM
  4. Range("B" & Rows.Count).End(3)(2).select
    By sohaila in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 04:46 PM
  5. Error rsh = Sheets(st).Range("A" & Rows.Count).End(xlUp).Row + 1
    By Jocatlett in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-12-2013, 10:52 AM
  6. Macro Error with code "Range("A65536").End(xlUp).EntireRow.Insert"
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 08:48 PM
  7. [SOLVED] Cells(Rows.Count, "b").End(xlUp).Row
    By Kate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2006, 11:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1