Consulting

Results 1 to 3 of 3

Thread: Solved: Dimming Intergers and Doubles

  1. #1
    VBAX Regular
    Joined
    Apr 2005
    Posts
    86
    Location

    Solved: Dimming Intergers and Doubles

    Is there a way to Dim something as a integer and then use that along side something else and Dim it as a double.

    For example;

    Dim iNum As Integer
    iNum = 1

    Dim reading(iNum) As Double

    I know this doesn't work, but is there any way of getting it to? How do i re-write the code??

    Many Thanks

    Pete
    If you can't convince them, confuse them!

  2. #2
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi Pete,

    Not quite sure what you're trying to achieve here.

    An array of doubles might do the trick (if you have a consecutive series of inums ...[vba]Dim iNum as integer
    dim reading(1 to 20) as double ' perhaps
    iNum = 1
    readng(inum) = 123456789[/vba]

    Or, perhaps a user-defined type[vba]Type PeteStuff
    iNum As Integer
    Reading As Double
    End Type
    Sub Something()
    Dim Stuff As PeteStuff
    Stuff.iNum = 1
    Stuff.Reading = 123456789
    ' rest of code
    End Sub[/vba]
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  3. #3
    VBAX Regular
    Joined
    Apr 2005
    Posts
    86
    Location
    Cheers Tony, i'll give that a go
    If you can't convince them, confuse them!

Posting Permissions

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