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: 313
Default 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
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
Calculate age Susan Sia Excel Discussion (Misc queries) 13 April 17th 09 07:49 AM
calculate time does not calculate Wanna Learn Excel Discussion (Misc queries) 4 August 19th 08 12:51 AM
Activesheet.Calculate failing to calculate Daniel Bonallack Excel Programming 2 October 11th 06 03:16 AM
calculate APR on ARM John McHugh Excel Worksheet Functions 1 May 14th 05 07:56 AM
Macro that hide or unhide and not calculate or calculate Jonsson Excel Programming 1 August 19th 03 04:22 PM


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

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

About Us

"It's about Microsoft Excel"