VBA Excel 2010 Removing Exponential Scientific Notation After Converting to String

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

This is a great programing example of converting scientific notation to an actual number. There is a function in VB that will do this without the need to write code to do a conversion. Round(expression [, numdecimalplaces]) does the same job except it does 4/5 rounding. the_answer=Round(Sheets("Sheet1").Range("A1"), 6) will produce the same result except it will round the last digit up to 7, so the_answer now contains 0.066667 rather than Replace Round with RoundDown to get the result.

williamberry
Автор

Thanks !  I'm currently writing procedures to copy and paste to a cell programmatically where the string of alphanumeric characters is copied to a specific cell, but it displays with a scientific notation - this is a great block of code, but handles a fairly large numbers of scenarios - my project deals with a string that is always going to start with 111, and more importantly, is always going to be 13 digits - is there a way to accomplish this with fewer lines of code, since, my scenario is always basically the same ?

steverollins