![]() |
Number Format Changes During VBA Copy/Paste
I have an Excel workbook with VBA code that copies a series of numeric values
from sheet 2 and pastes them into corresponding cells in sheet 1. In one case, the value in sheet 2 is 0.0170, but when pasted into sheet 1 it displays as 0.0200. Both cell formats appear to be identical, there's no rounding going on in the VBA, so can't for the life of me figure out why this is happening. Anyone have an idea? (Excel 2007 on Windows XP Pro) |
Number Format Changes During VBA Copy/Paste
post your code...
-- HTH... Jim Thomlinson "LarryP" wrote: I have an Excel workbook with VBA code that copies a series of numeric values from sheet 2 and pastes them into corresponding cells in sheet 1. In one case, the value in sheet 2 is 0.0170, but when pasted into sheet 1 it displays as 0.0200. Both cell formats appear to be identical, there's no rounding going on in the VBA, so can't for the life of me figure out why this is happening. Anyone have an idea? (Excel 2007 on Windows XP Pro) |
Number Format Changes During VBA Copy/Paste
I've continued to experiment, and discovered that the cell on sheet 2 was
formatted for Accounting/4 decimals/dollar sign, while the cell on sheet one was set to Number/4 decimals/no thousands separator. Resetting the former to match the latter appears to fix the problem, although if you can explain the "why" part to me I'd be interested to hear it. I would have thought that with both set to 4 decimals the transfer should have worked fine. "Jim Thomlinson" wrote: post your code... -- HTH... Jim Thomlinson "LarryP" wrote: I have an Excel workbook with VBA code that copies a series of numeric values from sheet 2 and pastes them into corresponding cells in sheet 1. In one case, the value in sheet 2 is 0.0170, but when pasted into sheet 1 it displays as 0.0200. Both cell formats appear to be identical, there's no rounding going on in the VBA, so can't for the life of me figure out why this is happening. Anyone have an idea? (Excel 2007 on Windows XP Pro) |
All times are GMT +1. The time now is 10:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com