Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7522661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:35:10+00:00 2026-05-30T02:35:10+00:00

Need some help finding the max value in a worksheet, I tried with range:

  • 0

Need some help finding the max value in a worksheet,

I tried with range:

Dim maxNumber As Double 
maxNumber = Application.WorksheetFunction.Max(Range("A1:B5"))

Except I don’t want it to stop at B5, I want it to go through the whole Worksheet.

So I found that “XFD1048576” symbolizes the last cell of a worksheet:

Dim maxNumber As Double 
maxNumber = Application.WorksheetFunction.Max(Range("A1:XFD1048576"))

Just wondering now if there’s a more elegant solution, anything to replace “XFD1048576”, or simply writing better code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:35:12+00:00Added an answer on May 30, 2026 at 2:35 am

    Why not use the “UsedRange” property?

    Your code example would then become something like:

    Dim maxNumber As Double  
    maxNumber = Application.WorksheetFunction.Max(ActiveWorkbook.Worksheets("Sheet1").UsedRange)
    

    You can also use the Cells property – ActiveWorkbook.Worksheets("Sheet1").Cells to search every cell, even if it’s empty. For this reason, I’d prefer to use UsedRange.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with finding some tutorials on how an iPhone communicate with
i need some help about finding elements position. im working on an e-book reader,
I am having trouble and need some help finding a correct SQL query. Here
I need some help finding a jQuery solution to display multiple images in a
I need some help finding a jQuery plugin which will allow me to display
I need some help with finding network interfaces based on a provided IP address.
Need some help about with Memcache. I have created a class and want to
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview
Need some help with this problem in implementing with XSLT, I had already implemented

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.