Reputation: 36713
I'm trying to return the value of a cell in an Excel spreadsheet, but it just shows "False" instead of the value of the cell.
Here's the function:
Function GenSelectStatement() As String
Dim retstring As String
Dim i As Integer
retstring = Cells(1, 2).Select
MsgBox "restring: " & Cells(2, 2).Select
GenSelectStatement = retstring
End Function
The cell in question has an alpha value like "xxx".
Both the msgbox display and the cell where the function is coded show "FALSE".
What am I doing wrong?
Upvotes: 1
Views: 3224
Reputation: 402
.Select is to select the cell.
If you want the value of the cell, try :
Worksheets("Data").Range("$P$1").Value
Take a look on that link: http://www.ozgrid.com/forum/showthread.php?t=11530
Regards, Jim.
Upvotes: 1