I've written a function in VBA that looks at the contents of certain nearby cells and then returns a string based on their values. I want this function to run on a whole column of cells. However, when I fill down, every single cell displays the same value, that of whichever cell I edited and pressed enter for. I've tried setting `Application.Volatile` as well as recalculating the sheet (both using `F9` and `ActiveSheet.Calculate`) but none of those have worked. I also tried setting `ActiveCell.Value` to be the string I want returned, and then not returning anything from the function, but excel says this is a circular reference. Any suggestions?
Here's (the relevant parts of) my code:
If scenario = "SR-1A" Then
first = "nofog"
secnd = "fog"
ElseIf scenario = "SR-1B" Then
first = "fog"
secnd = "nofog"
Else: foginSpeechP = "NOT A REAL SCENARIO in foginSpeechP"
If (IsNumeric(ActiveCell.Offset(0, 4)) And ActiveCell.Offset(0, 4) > 0) Then
currTimeStamp = ActiveCell.Offset(0, 4)
Else: foginSpeechP = "NO TIME STAMP IN FOGINSPEECHP()"
以上就是How do I get a range of cells with an Excel VBA function to calculate individually and not all display the same value?的详细内容，更多请关注web前端其它相关文章！