ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   coding vba (https://www.excelbanter.com/excel-programming/395626-coding-vba.html)

paul[_17_]

coding vba
 
hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???


Snake Plissken[_2_]

coding vba
 
Sub kod()

Dim varA, varB, varC As Integer

On Error Resume Next

' varA, varB, varC should be initialized somehow

If varB = 14 Then

varA = 4


ElseIf varC = 5 And varC <= 10 Then
varA = 16

Else

varA = 9

End If


End Sub



Jim Jackson

coding vba
 
The macro works as intended and exactly as Paul requested. Where is your
proof?
--



"barnabel" wrote:

Jim, you got the homework wrong.

That is setting A=9 if C is between 5 and 10 and doesn't set A otherwise.

"Jim Jackson" wrote:

If B = 14 then
A = 4
elseif C = 5 then
If C <=10 then
A = 9
End If
End If

--
Best wishes,

Jim


"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



Jim Jackson

coding vba
 
If B = 14 then
A = 4
elseif C = 5 then
If C <=10 then
A = 9
End If
End If

--
Best wishes,

Jim


"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



Jim Jackson

coding vba
 
What is your purpose in being so snotty while, at the same time, ofering no
useful help for the one asking for assistance? Do you not know how to
achieve what he asked for?
--
Best wishes,

Jim


"barnabel" wrote:

How did you do on the last homework assignment?

"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



barnabel

coding vba
 
How did you do on the last homework assignment?

"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



barnabel

coding vba
 
Jim, you got the homework wrong.

That is setting A=9 if C is between 5 and 10 and doesn't set A otherwise.

"Jim Jackson" wrote:

If B = 14 then
A = 4
elseif C = 5 then
If C <=10 then
A = 9
End If
End If

--
Best wishes,

Jim


"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



barnabel

coding vba
 
Where is the number 16? "otherwise it is to be set to 16 if the variable C
lies between 5 and 10 otherwise it will be set to 9"

"Jim Jackson" wrote:

The macro works as intended and exactly as Paul requested. Where is your
proof?
--



"barnabel" wrote:

Jim, you got the homework wrong.

That is setting A=9 if C is between 5 and 10 and doesn't set A otherwise.

"Jim Jackson" wrote:

If B = 14 then
A = 4
elseif C = 5 then
If C <=10 then
A = 9
End If
End If

--
Best wishes,

Jim


"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



barnabel

coding vba
 
Sure I do. Snake answered it correctly.

What is the point of having somebody do your homework for you? Why bother
taking the class?

"Jim Jackson" wrote:

What is your purpose in being so snotty while, at the same time, ofering no
useful help for the one asking for assistance? Do you not know how to
achieve what he asked for?
--
Best wishes,

Jim


"barnabel" wrote:

How did you do on the last homework assignment?

"paul" wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???



Ron Rosenfeld

coding vba
 
On Thu, 16 Aug 2007 04:47:34 -0700, paul wrote:

hwo do i write this into a VBA code
where i want variable A to be set to 4 if the variable B is greater or
equal to 14

otherwise it is to be set to 16 if the variable C lies between 5 and
10 otherwise it will be set to 9???


something like:

If B = 14 Then
A = 4
ElseIf C 5 And C < 10 Then
A = 16
Else
A = 9
End If
--ron


All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com