Forum Discussion

mohanakshi's avatar
mohanakshi
Contributor
14 years ago

Error while accessing cell of excel

Hi,

     I am getting error message as "Object not in collection"..... while executing this code line " for each cell in sheetobj.usedrange"





Please help me to solve this problem..



same code is working in another system but not in mine...!!!!!





 

  • Hi,





    Try using properties and methods provided by the Range object to iterate through its cells. Refer to Excel's built-in VBA reference for information on its object model.


  • Thank u..

       But we are running this code from 3 years.. now the same code is giving error message.. i wanted to know the reason...
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,



    This can happen because of different reasons. E.g. something was changed in the environment, something, that is present on the first environment is absent on the second one, etc.

    Considering the amount of information provided by you, I would suggest to look for the differences between your two systems and try to figure out what differences might matter.

    However, the more relevant information you provide (at least - the code snippet and the line that fails) the higher are the chances to get more definite answer.