Problem with scientific notations

TheRedCardinal

Board Regular
Joined
Jul 11, 2019
Messages
243
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
A simple part of my macro performs the following task:

  1. Loads all of the data in a specified range into an array
  2. Plays around with that data and outputs it into a different array
  3. Pastes that array into a dynamic range on another worksheet
One of my columns in the source data sometimes contains numbers that are so long they are switched to scientific notation.

I got around this by introducing this step before the loading of the array:

VBA Code:
.Range("D:D").NumberFormat = "0"

Visually at least this solved the problem for me in the source data, specifically that the scientific numbers are now standard, but also the non-numeric entries are unchanged.

I then did the various manipulation, and when I output the array, unfortunately the scientific notation is back.

All of the cells in the target array are set to text format:

VBA Code:
.Cells.NumberFormat = "@"

So I then added the same code as before for the specific column in the target range:

VBA Code:
.Range("I3:I" & LRow + 1).NumberFormat = "0"

But now my output works for the scientific numbers, but for all of the cells that contained text, now there is a number pasted, the source of which I can't determine.

For completeness, inside my loop this is the line that populates the new array with the data:

VBA Code:
RecibArray(Counter, 9) = SAPArray(Counter, 4)

I'm not sure how to proceed with this now? Any suggestions?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top