+ Reply to Thread
Results 1 to 8 of 8

How to select cell but exclude first 2 row?

  1. #1
    Forum Contributor
    Join Date
    03-12-2012
    Location
    Singapore
    MS-Off Ver
    MS 365
    Posts
    532

    How to select cell but exclude first 2 row?

    Hi, i'm quite noob at VBA. Only know the basic. I am writing a code where the entirerow will become bold wherever i select. HOwever, i discover that i need to unbold it when i change selection, if not, the entire sheet will become bold sooner or later. Hence i add it the code to unbold. However, my header (Row 1:2) which is suppose to be bold become unbold. What should i do to exclude Row 1 and Row 2 when i unbold?

    Is there a better way to do this other than my method as below??

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    try this:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-12-2012
    Location
    Singapore
    MS-Off Ver
    MS 365
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    Quote Originally Posted by ikboy View Post
    try this:
    Please Login or Register  to view this content.
    Hi, thanks it work. BUt just curious, does Usedrange = A1, den offset 2 mean row 1 and row 2 selected?

  4. #4
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    Try this you will easy understand:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-12-2012
    Location
    Singapore
    MS-Off Ver
    MS 365
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    Quote Originally Posted by ikboy View Post
    Try this you will easy understand:
    Please Login or Register  to view this content.
    Hi, i tried, but it only select A3. Not the entire Row3, if thats the case, then
    [code]
    ActiveSheet.UsedRange.Offset(2).Font.Bold = False
    [code/]

    wont that mean only A3 become unbold?

  6. #6
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    You try to type some words to other cell then you will know...

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: How to select cell but exclude first 2 row?

    @ikboy - nice job, however your macro will fail with a RUNTIME error in the unlikely event that either the last row or next to the last row contains data.

    @jp16- Try the following:
    Please Login or Register  to view this content.
    does Usedrange = A1, then offset 2 mean row 1 and row 2 selected?
    Please Login or Register  to view this content.
    Offset(2) is shorthand for Offset(2, 0) which means take the Used Range and move it 2 rows down and 0 columns to the right.
    UsedRange has nothing to do with what cell is selected, it refers to the 'Range of Cells' that are used on the sheet.

    Please Login or Register  to view this content.
    if 'A1' is the only cell used on the sheet, then cell 'A3' will be selected.
    if 'A1' and 'C4' are the only cells used on the sheet, then celsl 'A3 thru C6' will be selected.

    Lewis
    Last edited by LJMetzger; 03-15-2018 at 07:17 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to select cell but exclude first 2 row?

    @LJMetzger
    Your code is rigorous, thanks.

+ 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. Add EXCLUDE Option in table to Exclude from Solver
    By lbofbb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-17-2015, 09:05 AM
  2. [SOLVED] change to exclude select entries
    By mikerules in forum Excel General
    Replies: 5
    Last Post: 06-02-2014, 04:00 PM
  3. Copy cell value to new cell and exclude all spaces in process
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-28-2011, 03:42 PM
  4. How to exclude a cell from array
    By ezhenya in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-02-2010, 04:27 AM
  5. [SOLVED] Exclude a cell
    By DF2507 in forum Excel General
    Replies: 8
    Last Post: 07-10-2006, 03:29 AM
  6. Exclude a cell again
    By DF2507 in forum Excel General
    Replies: 2
    Last Post: 07-10-2006, 03:29 AM
  7. Exclude a cell from calculating
    By Drew in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-04-2005, 05:06 PM

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