+ Reply to Thread
Results 1 to 7 of 7

Want to exit sub if range have no data

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Want to exit sub if range have no data

    hello
    i m using below code to edit cells one by one in range, but there is little problem, if there is no data in range (c10:c300) and i run code then there is coming up a debug,
    i want if there is no data in range C10:C300 then exit the sub,..

    Please Login or Register  to view this content.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Want to exit sub if range have no data

    May be this........
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Want to exit sub if range have no data

    thanx works pertect

    will add u repu

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Want to exit sub if range have no data

    Haroon ! do you have only Numbers in your specified range Or You have Text Also!
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Want to exit sub if range have no data

    i have only text

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Want to exit sub if range have no data

    @hemesh

    Correct point raised. If the range may contain text in that case he may change COUNT to COUNTA in the code.

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Want to exit sub if range have no data

    @haroon

    If you have text only in the range then change the code to this........

    Please Login or Register  to view this content.

+ 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. If no matching number in range then exit sub
    By wrightyrx7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2014, 10:57 AM
  2. [SOLVED] Compare two folder files - whether they exit or not and if exit then copy to another foler
    By sthiru in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2012, 12:08 AM
  3. [SOLVED] Exit sub if range has ANY value
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2012, 03:21 AM
  4. How to exit a loop once the value is found in the range
    By Suety in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2010, 01:30 PM
  5. Importing data - then clearing it on exit
    By Radonsheep in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-22-2007, 05:06 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