Results 1 to 17 of 17

Thread: A Few VBA for Excel Questions

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Location
    Right here
    Posts
    275

    A Few VBA for Excel Questions

    Hi All,

    I have a few questions so I put them all in one post. Any help is, as always, appreciated.

    1)
    What's the best variable type to store a decimal number?

    I tried dimensioning it as a decimal but found I can't do this. I'm using the type Double at the moment and it works but wondered if there was a better type to use to store a standard decimal figure (as well as integers of course)

    2)
    Is there a command to clear a textbox? At the moment I have an error handling routine which checks to see if the entry into a textbox is a number or not (floating point) and if it isn't, it brings up a message box that says 'That is not a number!' or something along those lines.

    But I want to include a line before that which clears the textbox. I tried making the texbox.value = "" but the computer still thinks that's an error for some reason.

    Is there something like a textbox.clear command?

    3)
    If I select a range using VBA code, perform some action on that range, how then do I deselect the range after the calculation has finished?

    At the moment my code kinda goes like this:

    Code:
    Range("A1:A20).Select
    Perform Functions
    Range("A1").Select
    I put the last line in so that it deslects the range simply by selecting another cell, but what I actually need is something like:

    Code:
    Range("A1:A20).Select
    Perform Functions
    Range("A1:20").Deselect
    But there is no deselect, or unselect, function. So how do I just unselect the range without changing anything else?

    Cheers
    -Rob
    Last edited by TheRobster; Nov 21st, 2004 at 09:47 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width