Solved

How to return reference to sheet1 in excel

Posted on 2015-02-24
8
81 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
Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

 
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

Office 365 Advanced Training for Admins

Special Offer:  Buy 1 course, get 2nd free!  Buy the 'Managing Office 365 Identities & Requirements' course w/ Accelerated TestPrep, and automatically receive the 'Enabling Office 365 Services' course FREE!

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

734 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