LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why does cell format change when assigning a value?

I have some VBA code which accumulates a total of several cells, then puts
that total into a cell formatted as "Accounting" format. Every time this
code runs, it changes the cell formatting to "Currency".

I have tested this with a new, blank workbook and I get the same result.
Try the following:

Sub test()
a = 10
Cells(2, 1) = 0
a = a + Cells(2, 1)
Cells(3, 1).Value = a
End Sub

Why does it change the formatting??? And how do get around this problem?

--
N Selinger
 
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
Change cell colour on formula result change, no conditional format roster_jon Excel Programming 0 December 2nd 08 12:11 PM
assigning values to one cell which will change the formula in anot Darren Excel Worksheet Functions 1 July 26th 07 10:06 AM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
Change default path for assigning macros AuthorizedUser Setting up and Configuration of Excel 1 January 30th 05 07:06 PM


All times are GMT +1. The time now is 12:33 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"