我的countif功能如果不自动计算 - 我错过了什么吗?
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURLRequest *request = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:@"someURL" parameters:@{} error:nil];
NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
if (error) {
/* Network error*/
NSLog(@"Error: %@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
switch (httpResponse.statusCode) {
case 200:
NSLog(@"Success")
/* Code in case of success == Server returned True */
default:
/* Code in case of no success == Server returned False */
NSLog(@"Error");
}
}
}];
[dataTask resume];
当我使用以下命令时,我必须手动点击它并按回车键以显示更新的答案
Option Explicit
Function my3CountIfs(Rng1 As Range, Criteria1 As String, Rng2 As Range, Criteria2 As String, Rng3 As Range, Criteria3 As String) As Long
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case "Summary-Sheet", "Notes", "Results", "Instructions", "Template"
' do nothing
Case Else
my3CountIfs = my3CountIfs + Application.CountIfs(ws.Range(Rng1.Address), Criteria1, ws.Range(Rng2.Address), Criteria2)
End Select
Next ws
End Function
是的,我有excel设置为自动计算。
感谢您的帮助 - 今晚在这张excel表上发表演讲,发现它无法正常工作! - 哎呀!
答案 0 :(得分:0)
正如评论中提到的cyboashu,您需要将Application.Volatile
放在函数中。但正如Rik所说,这也可能导致性能问题。 This particular post及其答案与您的问题相关。
只是您可以选择的选项摘要:
Function xyz()
Application.Volatile 'or Application.Volatile = True in later versions
...
End Function
或某些手动按键
或者对我有用的选项(因为我每次运行特定的宏时只需要重新计算UDF)就像使用SendKeys
一样:
Sub xyz()
...
'Recalculates all formulas by simulating keypresses for {ctrl}{alt}{shift}{F9}
SendKeys "^%+{F9}"
...
End Sub