Solved

How to return reference to sheet1 in excel

Posted on 2015-02-24
8
76 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
8 Comments
 
LVL 33

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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now