+ Reply to Thread
Results 1 to 8 of 8

Selecting populated cells in a COLUMN - Efficient way - without selecting

  1. #1
    Registered User
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    91

    Selecting populated cells in a COLUMN - Efficient way - without selecting

    Hi Excel Forum,

    And a happy and prosperous 2021 to you all

    You have to excuse the vague title but it was the best way I could explain it.

    What I am trying to achieve is to name a range after part of a macro is run. I can do it with selection up but mother always tells me 'Never to select' in a macro as it is bad practice. So there must be a more efficient way which has now got me dumb founded.

    I attach a very primitive spreadsheet with the macro in the back and you will see what I am trying to do but below is the code that I jotted up before this post

    Please Login or Register  to view this content.
    As you can see I have located the last cell in the specific column but what to do after that has blown my mind or maybe I am thinking to deep into it as surely it can't be that hard?

    Any help would be greatly appreciated
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    537

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    Try
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    91

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    Maybe a wally mohadin, but do I need to dim the x and if so... as a range?

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    537

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    Right
    Please Login or Register  to view this content.
    Sorry forget to mention that

  5. #5
    Registered User
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    91

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    mohadin, you are a genius. Thank you so much.

    Can I be a pain but for my own limited knowledge

    How does the below 2 X's work?

    Please Login or Register  to view this content.
    What is it actually doing?

  6. #6
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    537

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    When you set x = Range...
    That's mean x is referencing that range
    And you deal with it as range
    In your case the first date
    So x.End(xlup) goes to the last date

  7. #7
    Registered User
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    91

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    Thank you

  8. #8
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    537

    Re: Selecting populated cells in a COLUMN - Efficient way - without selecting

    You are welcome
    And thank you for the feddback
    Be happy

+ 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] Selecting 3 ODD and 3 Evven numbers when randomly selecting from a range of cells
    By UltimateNeo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2019, 05:23 PM
  2. [SOLVED] Selecting all data in specific columns without selecting adjacent column.
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2014, 02:20 AM
  3. Selecting all data in specific columns without selecting adjacent column.
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2014, 03:50 PM
  4. Selecting range with set columns but down to last populated row
    By cloudwalking in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-22-2013, 09:35 AM
  5. Replies: 4
    Last Post: 01-31-2012, 01:08 PM
  6. Selecting only the cells populated with data not just the formula
    By BOR1003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2009, 01:21 PM
  7. establishing last row populated and selecting cells between first and last
    By iainiow in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2008, 07:54 AM

Tags for this Thread

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