Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel .end(xlUp) fails

Posted on 2012-12-28
7
Medium Priority
?
1,105 Views
Last Modified: 2012-12-29
The sub writes messages in Outlook to an Excel file. I need the script to select to lastRow in the excel file but the line "rInt = xlWks.Range("A65536").End(xlUp).Row" errors.
ol-xl-error.txt
0
Comment
Question by:spitcha
[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
7 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 38728681
dim rInt as a long instead, you probably have more than the 32 some thousands supported by the integer data type.
0
 

Author Comment

by:spitcha
ID: 38728690
Thanks for the reply. I get the same error after changing rInt to long
0
 
LVL 22

Expert Comment

by:Flyster
ID: 38728728
See if this will work:

rInt = .Cells(.Rows.Count, "A").End(xlUp).Row

Flyster
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:spitcha
ID: 38728740
Nope. Still getting the same error.
0
 

Author Comment

by:spitcha
ID: 38728756
The issue is with end(xlUp). I'm able to select or get any value, leaving this query out.
0
 
LVL 34

Accepted Solution

by:
Norie earned 2000 total points
ID: 38728759
xlUp is an Excel constant, you either need to use it's value,  -4162, or add a declaration for it.
Const xlUp = -4162

Open in new window

0
 

Author Closing Comment

by:spitcha
ID: 38728764
Adding this line fixed the issue.
Thanks much!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

730 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