+ Reply to Thread
Results 1 to 8 of 8

Code to select visible cell range only

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Code to select visible cell range only

    Hi friends,
    I want to select the visible cell range each time and border it outside up/down/left/right side. The cell range changes each time because the new data is enter in the table.

    Friends, please suggest me a code for it. My programme is ready only this code is require to complete it.

    The cell range starts from b2 to n... each time changing 'n' and row number.

    Thanking you.

    Sincerely,
    Mukesh
    Last edited by mukeshbaviskar; 12-22-2013 at 11:09 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Code to select visible cell range only

    Hi, Mukesh,

    maybe
    Please Login or Register  to view this content.
    IŽd take care to check if there is data available by checking the last visible row in Column B prior to copying:
    Please Login or Register  to view this content.
    if row 2 is the row with the headers.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Code to select visible cell range only

    Hi friends,
    I want to select the visible cell range each time and border it outside up/down/left/right side. The cell range changes each time because the new data is enter in the table.

    Friends, please suggest me a code for it. My programme is ready only this code is require to complete it.

    The cell range starts from b2 to n... each time changing 'n' and row number.

    Thanking you.

    Sincerely,
    Mukesh[/QUOTE]

  4. #4
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Code to select visible cell range only

    Hi Holger,
    Extremely sorry for mistake. Due to technical problem there are 2/3 repeted posts. I edited the post because I want to border the visible range.

    Please apologize me.

    Thank you for your quick response with solution. Please give me a code for corrected question.

    Sorry and thank you.

    Sincerely,

    Mukesh

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Code to select visible cell range only

    Hi, Mukesh,

    I canŽt see any reason for placing borders around an ever changing range, IŽd go with a list/table there. If there are really hidden rows inside the area extra lines will be set.

    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Code to select visible cell range only

    Hi Holger,
    Excellent! The code is working fine and giving correct output. I want to color the border so I added a line of code but it is not working. I want to color the border purple.

    Please see it and tell me where I'm wrong.

    Thank you.

    Sincerely,

    Mukesh
    Attached Files Attached Files

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Code to select visible cell range only

    Hi, Mukesh,

    ColorIndex 1 is black, you would need to set the color there like
    Please Login or Register  to view this content.
    Ciao,
    Holger

  8. #8
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Code to select visible cell range only

    Hi Holger,
    Excellent! It's working fine as per my requirement.

    Thank you for giving me a solution which gives the output in a single line than mine multiline code. I learned a simple code to set border today.

    Thank you very much.

    have a nice day!

    Sincerely,

    Mukesh

+ 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. Need code to select a cell range that has visible values
    By Big Chris in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-27-2013, 12:18 PM
  2. [SOLVED] Need Code to Select Next Visible Sheet
    By mo4391 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2013, 07:14 PM
  3. Vba code to copy and paste second visible cell to other worksheet range then the next
    By Justin25150 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2012, 09:03 AM
  4. Select Cell In Center Of Visible Range
    By Spencer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2011, 01:53 PM
  5. Select visible cells within a set range
    By longbow007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-09-2010, 09:10 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