title: How to get the cells value through Function in VBA Excel
body: <p>I am working on a task where the users enters first a column from “A” to “Z” and then a row number from 1 to 20. I have to write a 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.
  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) i.e. -32768.</p>
  
  <p>I have write some code for  the function getIntdata() but it cann't produce integer value. Can anyone please look what I am missing. Moreover, please guide me how to run function through Sub procedure.</p>
  
  <pre><code> Sub getIn()
  
       Dim Row As Integer
       Dim Column As String
              Column = InputBox("Please enter the column letter from A-Z", "Column Letter")
              Row = InputBox("Please enter the row number from 1-20", "Row Number")
              Debug.Print getIntData(Column, Row)
   End Sub
  
  
  Function getIntData(Col As String, Rw As Integer) As Integer
      Dim Result As Variant
        If Col = "" Or Rw &lt; 1 Then
           Result = "Invalid inputs"
        ElseIf Not IsNumeric(Range(Col &amp; Rw).Value) Then
           Result = -32768
        ElseIf Range(Col &amp; Rw).Value &lt;= -32768 Then
           Result = "!"
        ElseIf Range(Col &amp; Rw).Value &gt;= 32767 Then
           Result = "Now what?"
        Else
           Result = Range(Col &amp; Rw).Value
        End If
        MsgBox Result
     ' return value to caller
           getIntData = Result
   End Function
  </code></pre>