+ Reply to Thread
Results 1 to 3 of 3

convert empty label caption into number

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    convert empty label caption into number

    Hi all,

    could someone tell me if its possible to convert a blank string on a label into an integer?

    My form loads and populates a label.caption with the value of the activecell.value.

    Sometimes the activecell.value is empty and sometimes has a number in it.

    I need to do a calculation (label.caption * 2) but if the label.caption is empty it throws an error. I need it to treat an empty label as zero.

    Any help is greatly appreciated.

    Thanks
    John

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: convert empty label caption into number

    Test the contents of the active cell and do appropriate code on result.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: convert empty label caption into number

    Hi Andy, thanks for the reply. That is what I was doing but found a neater way now

    val(label.caption) * 2

    this will multiply the caption value by 2 even if the caption is empty.

    John

+ 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