Type Mismatch - shape properties vs cells value

LYoong 0 Reputation points
2023-02-10T15:48:54.9333333+00:00

Hiya, VBA is giving me type mismatch error when calculating value from excel range/cells value vs shape properties. Is there a way to resolve this error please?

Initially Range "A1" was a formula which I'd changed to a number (format cell as number too). By doing this the type mismatch error still there and it was highlighted at SclX = CapL / DimL

Appreciate for your help.

Dim SclX As Double
Dim DimL, CapL As Double
    
    DimL = SheetName.Range("A1").Value
    CapL = SheetName.Shapes.Range(Array("Rectangle 1")).Width
    
    SclX = CapL / DimL
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,689 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,716 questions
{count} votes