+ Reply to Thread
Results 1 to 6 of 6

Range Selection-how to do it?

  1. #1
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120

    Range Selection-how to do it?

    I'm trying to figure out how to have it select the entire column based on the active cell. so if i'm at N19, I want it to select N1:N19 and do something to all of them. This seems fairly easy, but I'm not sure how to do it. Any help will be greatly appreciated!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Couple of ways. Change select to your requirements

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120
    Quote Originally Posted by VBA Noob View Post
    Couple of ways. Change select to your requirements

    VBA Noob

    Thanks!!! Had to tweak it a bit, but works great!

  5. #5
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120
    So I could have sworn it worked earlier, but now it keeps having an error.

    here is the code is have:

    Please Login or Register  to view this content.
    The error I get is "Compile error: Wrong number of arguments or invalid property assignment" should it not be a string? Any help will be greatly appreciated as always!

  6. #6
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,

    I think the reason that your code is erroring is because the ".TintAndShade" property relates to an object not a range which is what you are formatting. I can't find "PatternTintAndShade" in the Excel2003 Helpfiles but suspect it will be the same issue. Even if the error relates to something else this code should still work as expected because the Help files say "You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property, 0 (zero) being neutral." (ie your line of code was making it neutral).
    I've also added a error check at the start of the macro to help stop unwanted errors (edit...) if anything other than a cell is selected when the macro is run.

    Please Login or Register  to view this content.
    Note selecting each area is not necessary & w/o this the need for identifying the current cell is removed because the selection isn't changed. Using "Union" stops the need for duplicating the lines of formatting code.


    hth
    Rob
    Last edited by broro183; 09-14-2008 at 03:44 AM. Reason: explanation of code changes
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ 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. Listbox selection from another listbox selection
    By reclmaples in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2008, 10:23 AM
  2. Range Selection on filtered table
    By minn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2008, 08:50 AM
  3. Resetting Spreadsheet Data Entry Cells
    By acg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2007, 02:08 PM
  4. Range Selection Problem
    By boylejob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2007, 12:09 AM
  5. Updating all cells in a specified range on sheet change.
    By a94andwi in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-01-2007, 08:52 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