Share via

ceiling meaning in vba code

Edward Evans 40 Reputation points
2026-04-23T15:03:30.02+00:00

ceiling in vba has what meaning; in If EnglishWidthIn <= AvailableWidthIn Then

ExtraLines = 0

Else

ExtraLines = Ceiling(EnglishWidthIn / AvailableWidthIn) - 1

End If

Microsoft 365 and Office | Word | For home | Windows
0 comments No comments

Answer accepted by question author

  1. Q&A Assist
    2026-04-23T15:03:50.6+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    In that VBA code, Ceiling is a function that rounds a number up to the next whole unit (or to the next multiple of a given significance, depending on how it is defined). In Access web apps and in Excel/Word VBA, the idea is the same: return the smallest integer greater than or equal to the given value.

    Conceptually for this line:

    ExtraLines = Ceiling(EnglishWidthIn / AvailableWidthIn) - 1
    
    1. EnglishWidthIn / AvailableWidthIn calculates how many “line widths” are needed to fit the text.
    2. Ceiling(...) rounds that value up to the next whole number of lines (because even 1.01 lines means 2 full lines are needed).
    3. Subtracting 1 gives the number of extra lines beyond the first.

    Example: if EnglishWidthIn / AvailableWidthIn = 2.1, then:

    • Ceiling(2.1) = 3
    • ExtraLines = 3 - 1 = 2 extra lines.

    In Microsoft documentation, the Ceiling function is defined as:

    • Excel/SharePoint/Word-style CEILING: returns a number rounded up, away from zero, to the nearest multiple of a specified significance.
    • Access custom web app Ceiling: returns the smallest integer greater than or equal to the numeric expression.

    So in this code, Ceiling is being used to ensure the number of lines is always rounded up so the text always fits.


    References:

    Was this answer helpful?

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.