Home > Software engineering >  How to complete cycle calculation for bosses VBA?
How to complete cycle calculation for bosses VBA?

Time:11-09

The code can only be completed in the graph line 2 to 33 the calculation of the line, now all I want to finish the whole column has a digital computing, excuse me how should change?

CodePudding user response:

If all the columns have content, use the following format:
Dim r as Integer
R=2
The Do while Worksheet (1). Range (" A "& amp; R). Text<& gt;" "And Worksheet (2). The Range (" A" & amp; R). Text<& gt;" "
The Do while IsNumeric (Worksheet (1) Range (" A "& amp; R). The Text) and IsNumeric (Worksheet. (2) the Range (" A "& amp; R). The Text)


Content calculated


Loop
R=r + 1
Loop

Get more VBA knowledge, pay attention to good fortune programming public number

CodePudding user response:

refer to the 1st floor programming reply:
if all columns have content, use the following format:
Dim r as Integer
R=2
The Do while Worksheet (1). Range (" A "& amp; R). Text<& gt;" "And Worksheet (2). The Range (" A" & amp; R). Text<& gt;" "
The Do while IsNumeric (Worksheet (1) Range (" A "& amp; R). The Text) and IsNumeric (Worksheet. (2) the Range (" A "& amp; R). The Text)


Content calculated


Loop
R=r + 1
Loop

Get more VBA knowledge, pay attention to auspicious number programming public

This I tried it on, it is good to run a jammed excel

CodePudding user response:

Try this ok (haven't tested) :
 
Sub calculations and drawing ()
Dim r As an Integer, x As String, y As String, op As String, z As Single
For r=2 To 9999
X=Worksheets (1). The Range (" A "& amp; R)
Y=Worksheets. (2) Range (" A "& amp; R)
Op=Worksheets. (3) Range (" A "& amp; R)
If x & lt;> "" And y & lt;> "" And op & lt;> "" Then
The Select Case Worksheets. (3) Range (" A "& amp; R)
The Case "+"
Z=CInt (x) + CInt (y)
Case ", "
Z=CInt (x) - CInt (y)
Case '*'
Z=CInt CInt (x) * (y)
Case "/"
Z=CInt (x)/CInt (y)
End the Select
Worksheets. (4) Range (" A "& amp; R)=z
End the If
DoEvents
Next
End Sub

CodePudding user response:

The
reference 3 floor milaoshu1020 response:
try this line not line (haven't tested) :
 
Sub calculations and drawing ()
Dim r As an Integer, x As String, y As String, op As String, z As Single
For r=2 To 9999
X=Worksheets (1). The Range (" A "& amp; R)
Y=Worksheets. (2) Range (" A "& amp; R)
Op=Worksheets. (3) Range (" A "& amp; R)
If x & lt;> "" And y & lt;> "" And op & lt;> "" Then
The Select Case Worksheets. (3) Range (" A "& amp; R)
The Case "+"
Z=CInt (x) + CInt (y)
Case ", "
Z=CInt (x) - CInt (y)
Case '*'
Z=CInt CInt (x) * (y)
Case "/"
Z=CInt (x)/CInt (y)
End the Select
Worksheets. (4) Range (" A "& amp; R)=z
End the If
DoEvents
Next
End Sub

Thank you bosses give advice or comments! But there's a small problem need to trouble, computing is not really to A9999, is just a virtual refers to, because not sure how many data,

CodePudding user response:

Data can be used with UsedRange scope;
  •  Tags:  
  • VBA
  • Related