如何继续VBA下一行的代码 [英] How to continue the code on the next line in VBA

查看:322
本文介绍了如何继续VBA下一行的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在VBA代码中输入数学论坛,其中有很多行。我想把它分成很多行。如何做?



例如:

  U_matrix( (i,j,n + 1)= k * b_xyt(xi,yi,tn)/(4 * hx * hy)* U_matrix(i + 1,j + 1,n)+(k *(a_xyt(xi, ,tn)/ hx ^ 2 + d_xyt(xi,yi,tn)/(2 * hx)))

很长想要分割它。



尝试这个:

  U_matrix i,j,n + 1)= k * b_xyt(xi,yi,tn)/(4 * hx * hy)* U_matrix(i + 1,j + 1,n)
_ +(k * a_xyt(xi,yi,tn)/ hx ^ 2 + d_xyt(xi,yi,tn)/(2 * hx)))

但不工作..需要一些指导。

解决方案

要在代码中加入换行符您使用 _



示例:

  Dim a As Integer 
a = 500 _
+ 80 _
+ 90

MsgBox a


I would like to type the mathematical forumla in VBA code which many lines. I would like to split it into many lines. How do I do it?

For example:

U_matrix(i, j, n + 1) = k * b_xyt(xi, yi, tn) / (4 * hx * hy) * U_matrix(i + 1, j + 1, n) + (k * (a_xyt(xi, yi, tn) / hx ^ 2 + d_xyt(xi, yi, tn) / (2 * hx)))

is very long. would like to split it.

Tried this:

U_matrix(i, j, n + 1) = k * b_xyt(xi, yi, tn) / (4 * hx * hy) * U_matrix(i + 1, j + 1, n) 
_+ (k * (a_xyt(xi, yi, tn) / hx ^ 2 + d_xyt(xi, yi, tn) / (2 * hx)))

But not working.. Need some guidance on this..

解决方案

To have newline in code you use _

Example:

Dim a As Integer
a = 500 _
    + 80 _
    + 90

MsgBox a

这篇关于如何继续VBA下一行的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆