Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default 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)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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)

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default 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)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
copy / paste format marco g 3284 Excel Worksheet Functions 1 August 12th 08 09:15 PM
Copy and Paste in certain format sa02000 Excel Worksheet Functions 3 March 25th 06 06:04 AM
format changes after copy/paste [email protected] Excel Discussion (Misc queries) 2 March 2nd 06 08:28 AM
Copy and Paste and keep format the same Brian Caraher Excel Discussion (Misc queries) 1 March 17th 05 02:05 PM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"