+ Reply to Thread
Results 1 to 12 of 12

Check if a cell is populated, if not, skip, but do nothing.

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Check if a cell is populated, if not, skip, but do nothing.

    Good afternoon people.

    Brief history...

    I have a small table. At the right of each row in the table is a little activeX control that will run a tiny script and populate 2 fields for that row.

    I.e. click the control on the right of the 1st row... and two cells in the 1st row are updated/populated/amended, click the 2nd control and the 2nd row gets updated/populated/amended.



    My problem...

    Not all of the table is always populated, and what I want is if someone hits a button on an unpopulated row, the script checks the first cell of that row, fir example B6 ... and just does nothing. No error, no message, just skips to the end of that segment of code.

    Each button is it's own code for it's own row, so if someone could provide guidance assuming cell B6 is the cell to check, I'm sure (well, I hope) i'll be able to amend the code for the other cells.



    This is the code I'm looking to wrap in some kind of skip if X not populated. By the way, populated can be ANYTHING, numbers data, dust on the screen... if that cell is populated, I want the script to run, if it isn't then, I want it skipped.

    Please Login or Register  to view this content.
    I hope what I'm asking for makes sense, and I'm grateful in advance for
    Last edited by Darth269; 02-12-2012 at 09:49 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Check if a cell is populated, if not, skip, but do nothing.

    I would check whether those cells are empty or not. If empty I wouldn't show the buttons.

    But in response to your question:

    Please Login or Register  to view this content.



  3. #3
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Check if a cell is populated, if not, skip, but do nothing.

    Personally, I'd get rid of the activeX controls to run your macro and use the worksheet selection change event. Then you can have just 1 script for every row on the worksheet:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Check if a cell is populated, if not, skip, but do nothing.

    Thanks SNB and SWOOP99 both are awesome suggestions...

    swoop99, because of a large number of other sheet variables i'm not sure yet how to code, and other adhoc changes that will be made during working, I'm trying to avoid 1 code and sheet wide changes, but, if I get my head around some of these issues, then yours will certainly be the way to go!.

    SNB, I actually hadn't thought of your first option, and think it's an awesome idea... however I'm ashamed to say I've no idea how to go about this... would you be kind enough to help with this too?

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Check if a cell is populated, if not, skip, but do nothing.

    you can check using:

    Please Login or Register  to view this content.
    Post a sample workbook to improve the 'helping' process.

  6. #6
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Check if a cell is populated, if not, skip, but do nothing.

    I honestly did consider posting it... but was a little nervous of being judge for it's PBeM Role Play content...


    Thanks again though SNB, you help really is appreciated.

  7. #7
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Check if a cell is populated, if not, skip, but do nothing.

    lol. nervous of being 'judged'?! You're in the right place here mate. Are we talking AD&D, Vampire or WoW?

  8. #8
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Check if a cell is populated, if not, skip, but do nothing.

    HA! Lol, yeah excuse my typo... It's actually a Play by Mail (email) custom game, not based on any set of rules I've encountered before. A zombie survival. Idea is to be the last man standing. www.Survive-z.com.

  9. #9
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Check if a cell is populated, if not, skip, but do nothing.

    Does it cost money? If not then I know about a dozen gamers might be interested.....

    P.S. I was ignoring the typo, just taking the mickey out of someone apparently ashamed of appearing geeky in a programming forum....ie, full of geeks. ;-)

  10. #10
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Check if a cell is populated, if not, skip, but do nothing.

    :-) Yeah when you put it that way... lol... Actually the first few games ( the beta I guess ) will not cost. I'm not sure if I'll charge at all, maybe a token fee... maybe not, it's not something I've considered yet.

  11. #11
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Check if a cell is populated, if not, skip, but do nothing.

    I'll post the web address around some other forums for ya.

  12. #12
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Check if a cell is populated, if not, skip, but do nothing.

    Man that'd be awesome, thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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