+ Reply to Thread
Results 1 to 7 of 7

How can I use the .value code?

  1. #1
    Registered User
    Join Date
    11-12-2007
    Posts
    30

    How can I use the .value code?

    Hi,
    I got the following bit of code from this forum a few days ago:
    Please Login or Register  to view this content.
    It works beautifully. I was just wondering about the .value extension, as essentially I want to modify one of the following to check for the letter X, rather than a number

    Please Login or Register  to view this content.
    Can I use the .Value extension or do I need to use another tag? I tried using

    Please Login or Register  to view this content.
    but it doesn't seem to work. What can I do? Is the >=1 bit the problem? If so, can I limit this to >=1 and <=99, and how can I do this?
    Last edited by cannon_lab; 12-20-2007 at 07:02 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Quote Originally Posted by cannon_lab
    Hi,
    I got the following bit of code from this forum a few days ago:
    Please Login or Register  to view this content.
    It works beautifully. I was just wondering about the .value extension, as essentially I want to modify one of the following to check for the letter X, rather than a number

    Please Login or Register  to view this content.
    Can I use the .Value extension or do I need to use another tag? I tried using

    Please Login or Register  to view this content.
    but it doesn't seem to work. What can I do? Is the >=1 bit the problem? If so, can I limit this to >=1 and <=99, and how can I do this?
    Please Login or Register  to view this content.
    should work

  3. #3
    Registered User
    Join Date
    11-12-2007
    Posts
    30
    What does .value mean specifically?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Quote Originally Posted by cannon_lab
    What does .value mean specifically?
    ? value
    specifically?
    http://en.wikipedia.org/wiki/Value

  5. #5
    Registered User
    Join Date
    11-12-2007
    Posts
    30
    Yeah that's really not helpful, if I wanted an answer from Wikipedia I would have gone on there.

    I mean what does it represent? - numbers, strings, letters
    How can it be used?

    I am new to VBA and most of the internet resources I have found on the subject are useless- they tell you how to achieve results, but not why it works.

  6. #6
    Registered User
    Join Date
    10-25-2006
    Posts
    54
    Hi

    Yeah - it's a bit of a minefield!...but good fun (honest!).

    .value is a property of a an object. Not all objects have the value property and the value is not always the same data type.

    In your example .value is the property of a range object so in its simplest form...

    fred=range("H8").value
    ...so fred is a carrier for whatever value is in cell "H8". fred can be anything you can like - it's a bag so that you can report on whatever is in cell "H8" so, later on, if you wanted to report on fred you could write

    msgbox (fred) which is the same as writing msgbox (range("H8").value)

    As a suggestion try and record some simple excercises in Excel using the Tools>Macro>Record tool. Then go and look at what you've recorded in the Visual Basic editor. The simpler you make them the easier it will be to understand the example.

    Hope that's of some help.

  7. #7
    Registered User
    Join Date
    11-12-2007
    Posts
    30
    Cheers, that is really useful.

+ 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