I have a command button that is averaging multiple cells (doing several averages). If one of the cells are empty than that cell doesn't get added to the average. If I were then to fill in that cell with a number and click the command button it would rerun the entire code including the other averages I'm running which would mess up the averages. How do I make the code only run the averages with cells filled out once?
The code I'm using is:
I don't want the code to run twice For the cells that were already averaged.
If anyone can help, I would greatly appreciate it.
Thanks
The code I'm using is:
Code:
Private Sub CommandButton1_Click()
Dim abcd As Worksheet
Set abcd = Sheets("Chossid")
Application.ScreenUpdating = False
abcd.Range("C7").Value = Application.WorksheetFunction.Average(abcd.Range("C7"), ActiveSheet.Range("C6"))
abcd.Range("D7").Value = Application.WorksheetFunction.Average(abcd.Range("D7"), ActiveSheet.Range("D6"))
abcd.Range("E7").Value = Application.WorksheetFunction.Average(abcd.Range("E7"), ActiveSheet.Range("E6"))
abcd.Range("F7").Value = Application.WorksheetFunction.Average(abcd.Range("F7"), ActiveSheet.Range("F6"))
Application.ScreenUpdating = True
End Sub
I don't want the code to run twice For the cells that were already averaged.
If anyone can help, I would greatly appreciate it.
Thanks