Solved

How to return reference to sheet1 in excel

Posted on 2015-02-24
8
82 Views
Last Modified: 2016-02-10
This spreadsheet was updated from MS Office 2012 to MS Office 2013.  Now code I used before sheet1.cells(5,2) comes back and tell me application-defined or object defined error.  So somewhere I lost a reference.   could someone please tell me how to get It back.  I cant seem to use sheet2.activate or anything referencing the sheets.

thanks
0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 34

Expert Comment

by:Norie
ID: 40628663
Can we see the rest of the code?
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 40628670
MS Office 2012 ??
0
 

Author Comment

by:mgmhicks
ID: 40628740
this doesn't work  sheet1.Cells(5, 2)

but this does work cells(5,2)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
FarWest earned 500 total points
ID: 40628751
it should  work!! can you see sheet1 in project explorer in code window?

make sure that you have at least those references in the project
excelref.jpgif still not working try this
dim sheet1 as worksheet
set sheet1 = activeworkbook.worksheets(1)

Open in new window

0
 

Author Comment

by:mgmhicks
ID: 40628766
I know right.  I have other worksheets that are just fine.  Here are my references.

References.png
0
 
LVL 12

Expert Comment

by:FarWest
ID: 40628815
I think references are fine
can you see sheet1 as this excelproj.jpg
0
 

Author Comment

by:mgmhicks
ID: 40629891
Yes, I do.   it does the same for other sheets within the same workbook.
0
 
LVL 12

Expert Comment

by:FarWest
ID: 40629980
Will you send me the file. You can remove any data inside but keep the sheets. And make sure that the problem still exists in the uploaded file
BTW did the code I gave you before solved the problem?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question