Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is there a way to Calculate with a VBA?
I am looking for a way to lock and color a cell based on another cell. But if
the cell is locked i want it to value based on a formula and if it is NOT locked I want the used to be able to enter any value he/she wants. I have 24 cells that will need to be formatted this way. So far I formatted 4 of them and my form doesn't populate fast enough. It takes 2+ minutes to complete. and that's IF it ever does complete. Sometimes there is an error and the program stops responding. Here is the VBA Script I am using to update ONE cell. If Range("C2").Value = 0 Then ActiveSheet.Unprotect Range("C4").Locked = True Range("C4").Interior.ColorIndex = 6 Range("C4").Formula = "=D4/B4" ActiveSheet.Protect End If If Range("C2").Value = 1 Then ActiveSheet.Unprotect Range("C4").Locked = False Range("C4").Interior.ColorIndex = x1none Range("C4").Formula = "0" ActiveSheet.Protect End If I was thinking there might be a way to link 6 of the cells together since it's really 4 sets of 6 cells that need to similarly formatted with a particular formula. Kind of hard to explain. But even with just 1 of each type of auto formatting the form doesn't work. Is there anything else I can do to slim down this VBA Script? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate age | Excel Discussion (Misc queries) | |||
calculate time does not calculate | Excel Discussion (Misc queries) | |||
Activesheet.Calculate failing to calculate | Excel Programming | |||
calculate APR on ARM | Excel Worksheet Functions | |||
Macro that hide or unhide and not calculate or calculate | Excel Programming |