问题列表 - 第19067页

通过vba在Excel中添加单元格公式

我不是Excel或VBA专家,但我想使用VBA将此当前excel公式插入到单元格中.

当前的Excel公式:

=IF(OR(ISNUM(D570)=FALSE;ISNUM(D573)=FALSE);"";IF(C573="Total";D573-D570;""))
Run Code Online (Sandbox Code Playgroud)

VBA公式:

 ActiveSheet.Range("a" & ActiveSheet.Rows.Count).End(xlUp).Offset(2, 12).Value = "=IF(OR(ISNUM(R[-3]C[-9])=FALSE;ISNUM(R[0]C[-9])=FALSE);'';IF(R[0]C[-10]='Total';R[0]C[-9]-R[-3]C[-9];''))"
Run Code Online (Sandbox Code Playgroud)

它不起作用......有人可以帮我吗?

excel vba formula excel-vba

6
推荐指数
2
解决办法
3万
查看次数

Perl中单引号和双引号之间的区别是什么?

我刚开始学习Perl.我查看了开始的perl页面并开始工作.

它说:

单引号和双引号之间的区别在于单引号意味着它们的内容应按字面意思理解,而双引号意味着它们的内容应该被解释

当我运行这个程序时:

#!/usr/local/bin/perl
print "This string \n shows up on two lines.";
print 'This string \n shows up on only one.';
Run Code Online (Sandbox Code Playgroud)

它输出:

This string
 shows up on two lines.
This string
 shows up on only one.

我错了吗?perl的版本如下:

perl -v

This is perl, v5.8.5 built for aix

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl …
Run Code Online (Sandbox Code Playgroud)

syntax perl interpolation

5
推荐指数
1
解决办法
3443
查看次数

如何在Python中搜索正则表达式匹配?

我需要尝试一个字符串对多个(独占 - 意味着匹配其中一个的字符串不能匹配任何其他)正则表达式,并根据它匹配的代码执行不同的代码.我现在拥有的是:

m = firstre.match(str)
if m:
    # Do something

m = secondre.match(str)
if m:
    # Do something else

m = thirdre.match(str)
if m:
    # Do something different from both
Run Code Online (Sandbox Code Playgroud)

除了丑陋之外,这个代码与所有正则表达式相匹配,即使它匹配其中一个(比如firstre),这是低效的.我试着用:

elif m = secondre.match(str)
Run Code Online (Sandbox Code Playgroud)

但是我知道if语句中不允许赋值.

有没有一种优雅的方式来实现我想要的?

python regex switch-statement

5
推荐指数
1
解决办法
199
查看次数

指定动态编译的输出路径

我在Java 6中的动态编译工作正常.但是,我想改变输出路径.我已经尝试了很多东西(我会饶了你)无济于事.无论如何,这是工作代码

String[] filesToCompile = { "testFiles/Something.java" };
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjects(filesToCompile);
CompilationTask task = compiler.getTask(null, fileManager, null,null, null, compilationUnits);
System.out.println("Good? " + task.call());
Run Code Online (Sandbox Code Playgroud)

但输出转到源目录,这不是我想要的.

我怀疑答案可能在于答案,compiler.getTask但API并不是非常清楚某些参数可能意味着什么.或者也许使用fileManager.我试过了

fileManager.setLocation(StandardLocation.locationFor("testFiles2"), null);
Run Code Online (Sandbox Code Playgroud)

但同样,猜测可能不是一个好主意.

谢谢!

编辑:我也试过使用选项,这样(对不起,如果有更紧凑的方式):

    final List<String> optionsList = new ArrayList<String>();
    optionsList.add("-d what");
    Iterable<String> options = new Iterable<String>() {         
        public Iterator<String> iterator() {
            return optionsList.iterator();
        }
    };
Run Code Online (Sandbox Code Playgroud)

然后将选项传递给getTask,但错误消息是"无效标志".

java dynamic-compilation java-6

9
推荐指数
2
解决办法
5364
查看次数

在Smalltalk中获取邮件的发件人

是否有一种实用的方法可以在Smalltalk中获取消息的发送者而无需手动将self作为参数传递

更具体一点:我想为传递给我的类的ID添加一个特定于类的前缀,所以如果ClassA发送(在类侧)

ClassB doSomethingWith: 'myId'.
Run Code Online (Sandbox Code Playgroud)

ClassB应该在内部将'myId'视为'ClassB-myId'或类似的东西.

我用一个必须是self的附加参数实现了这一点

ClassB doSomethingWith: 'myId' for: self.
Run Code Online (Sandbox Code Playgroud)

但如果没有这种明确的自我发送解决方案,我会很高兴.

oop smalltalk squeak

1
推荐指数
1
解决办法
671
查看次数

用子进程包装cmd.exe

我尝试使用以下程序在Windows下包装cmd.exe但它不起作用,它似乎等待某些东西并且不显示任何内容.知道这里有什么问题吗?

import subprocess

process = subprocess.Popen('cmd.exe', shell=False, stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=None)  
process.stdin.write("dir\r\n")  
output = process.stdout.readlines()  
print output
Run Code Online (Sandbox Code Playgroud)

python windows subprocess

3
推荐指数
2
解决办法
2万
查看次数

Hackystat只在学术上有趣吗?

我偶然发现了Hackystat,并对这个项目感到惊讶

  • 自2001年以来一直存在
  • 50个公开发布
  • 非常积极的发展

...但是没有关于它的StackOverflow问题.

有没有人利用任何传感器或系统本身的非学术性,即"真实世界"的原因?所有人都有经验吗?

visualization

2
推荐指数
1
解决办法
435
查看次数

在NSTableView中着色一行

我想要做的是在单击I按钮时在NSTableView中设置所选行的背景颜色.我看到那里的人使用过的其他案件tableView:willDisplayCell:forTableColumn:row:setBackgroundColor:,但我不认为这会在我的情况,我想点击一个按钮,当它发生的工作.

我知道我可以使用NSTableView的selectedRow方法找到所选行并为单元格设置背景颜色setBackgroundColor:,但我不知道该怎么办是从NSInteger获取所选行到NSCell来设置背景颜色.

cocoa objective-c

5
推荐指数
3
解决办法
8836
查看次数

Excel VBA开发最佳实践

我们是一名ISV,拥有开发和分发用VB6编写的桌面应用程序的经验.我们现在正在开发包含VBA代码的Excel电子表格工具.这些将免费下载给包括当地政府组织在内的各种用户.

我们以前很少在我们自己的组织之外分发电子表格.我们应该遵循哪些最佳做法,是否存在我们应该注意的陷阱?

我知道以下内容.

excel vba

10
推荐指数
1
解决办法
1626
查看次数

动态使用addEventListener?

我在flash中创建了一个导航栏,其中有5个不同的动画片段我用作按钮.每个动画片段(按钮)都有不同的实例名称.有没有办法使用addeventlistener,所以我不必像这样做:

//for button1
 button1.buttonMode = true;// Show the hand cursor
button1.addEventListener(MouseEvent.ROLL_OVER, button1_over);
button1.addEventListener(MouseEvent.ROLL_OUT, button1_out);
button1.addEventListener(MouseEvent.CLICK, button1_click);

function button1_over(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("over");
}

function button1_out(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("out");
}

function button1_click(e:MouseEvent):void
{
    var request:URLRequest = new URLRequest("http://website.com");
    navigateToURL(request);
}
//for button2
button2.buttonMode = true;// Show the hand cursor
    button2.addEventListener(MouseEvent.ROLL_OVER, button2_over);
    button2.addEventListener(MouseEvent.ROLL_OUT, button2_out);
    button2.addEventListener(MouseEvent.CLICK, button2_click);

    function button2_over(e:MouseEvent):void
    {
        e.currentTarget.gotoAndPlay("over");
    }

    function button2_out(e:MouseEvent):void
    {
        e.currentTarget.gotoAndPlay("out");
    }

    function button2_click(e:MouseEvent):void
    {
        var request:URLRequest = new URLRequest("http://website.com");
        navigateToURL(request);
    }
Run Code Online (Sandbox Code Playgroud)

...等所有五个按钮?

actionscript-3

1
推荐指数
1
解决办法
1222
查看次数