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: 24
Default VBA Automatically Changes Cell Format?

This is NOT a priority as I've worked around it, but I'm really curious if
there's a way to make VBA stop doing this...

I have the following code in a "Repair Formulas" Sub...
-------------------------------------------------------------------------------
Range("AA103").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$G$2"
Range("AA104").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$H$2"
Range("AA105").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$I$2"
Range("AA106").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$J$2"
Range("AA107").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$K$2"
Range("AA108").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$L$2"
Range("AA109").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$M$2"
Range("AA110").Formula = "=[NEHKB3_Source.xls]CabinetInfo!$N$2"
--------------------------------------------------------------------------------

All of the cells I'm repairing are formatted as General. For whatever
reason when the code runs to repair Range AA104 it changes that cells format
to Text... which of course makes the formula show up instead of the result,
which crashes my program when the user tries to get the data from that cell
to show up on a userform. If I do this:
--------------------------------------------------------------
Range("AA101:AG148").NumberFormat = "General"
--------------------------------------------------------------
At the end of the repair Sub it does in fact set the entire range to
General. If I have this code at the top of the Sub it changes AA104 to Text
as soon as it executes that line in the code.

This is also happening with several other seemingly random cells on this
same worksheet (which is why my NumberFormat Range is as big as it is.

Any ideas why this is happening and what I might do to correct it?... other
than the work around I'm already using.

Thank you
CB Hamlyn


 
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
cell automatically changing format YESHWANT JOSHI[_2_] Excel Discussion (Misc queries) 2 July 24th 09 08:18 PM
automatically format cell based on content of another cell Blustreaker Excel Worksheet Functions 2 July 15th 07 11:52 AM
How to format this number cell automatically Orc Thrall Excel Discussion (Misc queries) 1 July 6th 06 02:23 AM
How do I format tabs to automatically go to next cell I want Bro Excel Worksheet Functions 1 January 10th 06 04:02 PM
how do i automatically format a cell to only recognize the first w BMoneeTheMoneeMan Excel Discussion (Misc queries) 2 March 21st 05 06:39 PM


All times are GMT +1. The time now is 12:17 PM.

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"