1

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?

4

1 回答 1

1

.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.

于 2012-07-25T20:59:54.537 回答