Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error !1004' ?????

Status
Not open for further replies.

JensKKK

Technical User
May 8, 2007
119
GB
Run time error !1004': Method 'Cells of Object '_Global ' failed.

Number_of_Proteins = Cells(9990, 9)

What does this error message mean.

I see this error message frequently and the only way to make it disapear is to shorten my VBA code.

Any idea why this error mesaage can occur.

The error is not related to the syntax of the VBA command.
 



Hi,

Explicitly reference the sheet...
Code:
Number_of_Proteins = [b]objMySheet[/b].Cells(9990, 9)
...whatever objMySheet happens to be for you.

Skip,

[glasses] [red][/red]
[tongue]
 
When you say:
Code:
I see this error message frequently and the only way to make it disapear is to shorten my VBA code.

... show us the full code, and also the shortened code.


Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Look like it works Skip.

I changed code from


Sheets("algorithms").Select
Number_of_Proteins = Cells(9990, 9)

to


Number_of_Proteins = Sheets("algorithms").Cells(9990, 9)


and it worked.

Brilliant
 
When you try to reference a set of cells or a range, you must be explicit in telling excel which cells or which range. Range A1:A10 could exist on any sheet in the workbook so you need to tell excel which set of cells to reference...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top