Full Version: Get Excell cell value
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
bobdee
I'm able to open the Excel workbook and worksheet using:

CODE
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Open _
(Me.ImportFile)

Set oSheet = oBook.Worksheets(WorkSheetName)
ValueofCell = oSheet.Cells(CellName).Value


Let's not get hung up on declarations and where WorkSheetName and CellName come from. This all works okay and appropriate declarations are in my code.

My problem is with the ValueofCell statement. CellName is in the form 'A25', 'F15', etc. Whereas oSheet.Cell requires row number and column number.

Is there an alternative to Cells or can I convert A25 to Row 1 Column 25 in code.

Thanks.
maximus_cat
If I recall correctly, you can use:
CODE
ValueofCell = oSheet.Range(CellName).Value
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.