Wrong number format

bobkap

Active Member
Joined
Nov 22, 2009
Messages
323
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I have a text field with entries like this: 001-2024. However, when I bring them over to another worksheet via VBA code I get the entry in scientific notation.
Any help would be greatly appreciated. I've tried reformatting the fields from and to but it still does not fix the problem.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Have you tried putting an apostrophe in front of the text field ?
Can you post the code ?
 
Upvote 0
Have you tried putting an apostrophe in front of the text field ?
Can you post the code ?
Thanks. By declaring the field to be text doesn't that assume the apostrophe?

Here's the code that "tells" the entry to place it in a specific row and column:
VBA Code:
worksheets("Report").Cells(toprow, Invordcol) = Worksheets("Main").Cells(finalrow, repordcol)
VBA Code:
 
Upvote 0
Are you pasting to a blank cell ?
Also,try
  • Select the cell
  • Go to Data >> Data Tools >> Text to Columns
  • Click Next button twice to reach Step 3 of 3
  • In Step 3, select Text
  • Click Finish
 
Upvote 0
Are you pasting to a blank cell ?
Also,try
  • Select the cell
  • Go to Data >> Data Tools >> Text to Columns
  • Click Next button twice to reach Step 3 of 3
  • In Step 3, select Text
  • Click Finish
Thanks again. That did not work. It changed this "7.13679E+11" to "713679223131" it needs to be 033-2024.
 
Upvote 0
Probably:
VBA Code:
worksheets("Report").Cells(toprow, Invordcol) = "'" & Worksheets("Main").Cells(finalrow, repordcol).Text
 
Upvote 0
Probably:
VBA Code:
worksheets("Report").Cells(toprow, Invordcol) = "'" & Worksheets("Main").Cells(finalrow, repordcol).Text
Many thanks. I tried that but got this '713679223131 instead of the original entry of 033-2024.
 
Upvote 0
did you try the apostrophe ??
 
Upvote 0
Ok, so maybe post all the code ??
Only because it seems nothing suggested is solving the issue.
 
Upvote 0

Forum statistics

Threads
1,216,756
Messages
6,132,535
Members
449,733
Latest member
Nameless_

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