Accurate determination of the size of nanoparticles has an important role in many different scientific and industrial purposes, such as in material, medical and environment sciences, colloidal chemistry and astrophysics. We describe an effective optical method to determine the size of nanoparticles by analysis of transmission and scattering of visible spectral range data from a designed UV-Vis multi-spectrophotometer. The size of the nanoparticles was calculated from the extinction cross section of the particles using Rayleigh approximation and Mie theory. We validated the method using polystyrene nanospheres, cellulose nanofibrils, and cellulose nanocrystals. A good agreement was achieved through graphical analysis between measured extinction cross section values and theoretical Rayleigh approximation and Mie theory predictions for the sizes of polystyrene nanospheres at wavelength range 450 - 750 nm. Provided that Rayleigh approximation's forward scattering (FS)/back scattering (BS) ratio was smaller than 1.3 and Mie theory's FS/BS ratio was smaller than 1.8. A good fit for the hydrodynamic diameter of nanocellulose was achieved using the Mie theory and Rayleigh approximation. However, due to the high aspect ratio of nanocellulose, the obtained results do not directly reflect the actual cross-sectional diameters of the nanocellulose. Overall, the method is a fast, relatively easy, and simple technique to determine the size of a particle by a spectrophotometer. Consequently, the method can be utilized for example in production and quality control purposes as well as for research and development applications.