+ Reply to Thread
Results 1 to 10 of 10

Return the content of a user selected cell.......THX

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    5

    Return the content of a user selected cell.......THX

    Hi guys....

    need your help....

    I have to create a funciton where the user enters first a column from “A” to “Z” and then a row number from 1 to 20. I have to write a function function getIntData(col as String, row as Integer) as Integer that returns the content of that cell in the active worksheet and shows it in a message box.

    THX a LOT.............

  2. #2
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Return the content of a user selected cell.......THX

    FireTheft,

    How about this?
    Let me know if you need/wnat anything else!


    Simeon
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Return the content of a user selected cell.......THX

    thx a lot...

    what I also need to be solved would be:

    If the number is the maximum negative Integer
    show instead a message box with an exclamation mark.
    The function getIntData returns an Integer value. If the content of the cell is not numeric then return
    the maximum possible negative value (-2^15).


    THANK YOU....

  4. #4
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Return the content of a user selected cell.......THX

    Wow!

    I am sorry, you totally lost me on that last one!
    If I understand this correctly you want the greatest negative power that is equal to a non numeric value?


    Simeon

  5. #5
    Registered User
    Join Date
    10-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Return the content of a user selected cell.......THX

    It's meant like this...

    if the value is -32,768 (which equals -2^15) than a message box with an exclamation mark should pop up.
    and if the content of the cell is not numeric then return the maximum possible negative value -32,768 (-2^15).

    THXXXXXXXXXXXXXX

  6. #6
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Return the content of a user selected cell.......THX

    I see...

    Do you have an example with real data in it that I would be able to look at?

    Simeon

  7. #7
    Registered User
    Join Date
    10-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Return the content of a user selected cell.......THX

    no sorry I have no sample.....

    is part of a homework for the university ;-(

  8. #8
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Return the content of a user selected cell.......THX

    Thats Ok.

    I think I have figured it out. Now do you need the (-2^15) diplayed ot the number itself?

  9. #9
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Return the content of a user selected cell.......THX

    Ok, try this out and let me know if this works for you!


    Simeon
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Return the content of a user selected cell.......THX

    My function look like this:

    Function Test()

    'The users enters first a column from “A” to “Z” and then a row number from 1 to 20. Write a function
    'function getIntData(col as String, row as Integer) as Integer that returns the content of that cell in
    'the active worksheet and shows it in a message box. If the number is the maximum negative Integer
    'show instead a message box with an exclamation mark.

    Dim Col As String
    Dim row As Integer

    Place:

    Col = InputBox("Please enter the column letter.", "Column Letter")
    row = InputBox("Please enter the row number.", "Row Number")


    If IsNumeric(Range(Col & row).Value) >= [-32768] Then
    MsgBox ("!")
    End If

    If IsNumeric(Range(Col & row).Value) = False Then
    MsgBox ("-32768")

    Else
    MsgBox (Range(Col & row).Value)
    End If
    End Function

    The Problem now is that it puts out as content of the cell with the value -50000 an exclamation mark and afterthat -50000. In this case I just want the ! to pop up....
    A similar problem exists when i open a cell with "k" in it.....then it makes an "!" and the value -32768....but in this case i just need the -32768....
    The last point should also work for empty cell......but it doesnt......

    Thx in advance....

+ 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