C
CB Hamlyn
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
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