[Webinar] Streamline your web hosting managementRegister Today


How to return reference to sheet1 in excel

Posted on 2015-02-24
Medium Priority
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.

Question by:mgmhicks
LVL 36

Expert Comment

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

Expert Comment

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

Author Comment

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

but this does work cells(5,2)
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

LVL 12

Accepted Solution

FarWest earned 2000 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


Author Comment

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

LVL 12

Expert Comment

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

Author Comment

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

Expert Comment

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?

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
If Skype for Business came with your office 2016 or office 365 installation, you may find that it's almost impossible to either disable or remove it. The application will often launch with each start of Windows, even when explicitly configured not t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…

591 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