• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1171
  • Last Modified:

Excel .end(xlUp) fails

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
spitcha
Asked:
spitcha
1 Solution
 
nutschCommented:
dim rInt as a long instead, you probably have more than the 32 some thousands supported by the integer data type.
0
 
spitchaAuthor Commented:
Thanks for the reply. I get the same error after changing rInt to long
0
 
FlysterCommented:
See if this will work:

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

Flyster
0
Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

 
spitchaAuthor Commented:
Nope. Still getting the same error.
0
 
spitchaAuthor Commented:
The issue is with end(xlUp). I'm able to select or get any value, leaving this query out.
0
 
NorieVBA ExpertCommented:
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
 
spitchaAuthor Commented:
Adding this line fixed the issue.
Thanks much!
0

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now