excel cell value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

want to check for a specific value in col 1 and row 1. if that value is not
there, will cancel the operation.

how do i check for that value?

tried this

xlsheet.cells("1:1") = rowvalue

If rowvalue = "code" Then
GoTo contin
Else
GoTo Err_addl_update_Click
End If
contin:

rowvalue is defined as a string

get error msg that not valid construct

thanks for your help
 
want to check for a specific value in col 1 and row 1. if that value is not
there, will cancel the operation.

how do i check for that value?

tried this

xlsheet.cells("1:1") = rowvalue

If rowvalue = "code" Then
GoTo contin
Else
GoTo Err_addl_update_Click
End If
contin:

rowvalue is defined as a string

get error msg that not valid construct

thanks for your help

Aren't Excel cells indexed by letters in the columns, not numbers? Try "A:1".

If you're running this code in Excel, please post your questions in an Excel
newsgroup.

John W. Vinson [MVP]
 
that did not work

i have done something like this because i had to insert a row
xlsheet.rows("1:1").Insert
xlsheet.cells(1, 1) = "aaaa"

therefore i thought i could do
if xlsheet.rows ("1:1").value = "code" then
do stuff
 
that did not work

i have done something like this because i had to insert a row
xlsheet.rows("1:1").Insert
xlsheet.cells(1, 1) = "aaaa"

therefore i thought i could do
if xlsheet.rows ("1:1").value = "code" then
do stuff

I'd ask in an Excel newsgroup, or repost under a new header - this is Excel
syntax with which I am not familiar.

John W. Vinson [MVP]
 
If you've already created an Excel worksheet object you can get the
value of cell A1 with
xlsheet.Cells(1,1).Value 'row 1, column 1
or
xlsheet.Range("A1").Value

To save launching Excel, you can do it like this (watch out for line
wrapping in the Set R... statement:

Dim R As DAO.Recordset

Set R = CurrentDB.OpenRecordset("SELECT F1 FROM [Excel8.0;" _
& "HDR=No;database=C:\folder\XXX.xls;].[Sheet1$A1:A1];")

'The value you want is now in R.Fields(0).Value
...
R.Close
 
Back
Top