Excel cannot read cell in VB code

Asked

Viewed 100 times

3

x.Range("A1:z1").Select
x.Goto Reference:="R2C4"
verificaCel =     x.ActiveCell.FormulaR1C1

if verificacel then

I am not able to read the specific cell in the excel spreadsheet, in which I will send the data to a database.

  • 1

    To check something you must put what needs to be checked, example verificacel = "teste"... give a debug.print verificacel to check the value you have in this variable.

  • This value appears in the check "=SUMIF(Matrix!C[6],RC[-4],MATRIX!C[5])" ...and what should appear is a value "314.82"

  • So instead of using the x.ActiveCell.FormulaR1C1 use x.ActiveCell.Value

  • It worked/o/o/o/

  • Thank you very much!!!

  • As the problem was solved, I posted the reply to mark as a response and leave as reference to other colleagues.

Show 1 more comment

1 answer

1

To read the cell value you must use .value or .text if applicable. Using .FormulaR1C1 the result will be the cell formula. Follow correction below:

verificaCel = x.ActiveCell.Value
  • Thank you Evert. As they say. "simple as this" rs

  • 1

    Mark mark as answer by clicking on the gray "V" next to the answer to turn green. It means the answer solved your problem. Thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.