Number Format

jagrenet

Board Regular
Joined
Feb 23, 2022
Messages
81
Office Version
  1. 365
  2. 2013
  3. 2011
  4. 2010
Platform
  1. Windows
Hello,

I am having an issue when copying a regular or standard number such as "3" from one spreadsheet to another using VBA code. The information gets transferred between sheets just fine however, the formatting gets changed from "3" to "44726.8677777778".

There are times where the standard number might be 20.07 or something with 2 digits on either side of the decimal. Other times, just whole numbers. These numbers are representing Total hours worked on a project and subsequently, get compiled on a Monthly Report, the "Target sheet".

The column is "C" and the amount of Rows changes from month to month. So, I have the code counting the Rows using -

Dim iTime As Range

Set iTIme = MyData.Range("C", Cells(Rows.Count, "C").End(xlUp).Offset(-2))
iTime.NumberFormat = "##.##"

I have tried various iterations of setting this variable but it always comes out with the "long" number.
Not sure what I am doing wrong.

Thanks,
Jeff
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,222
Messages
6,123,709
Members
449,118
Latest member
MichealRed

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