#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default 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???


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default 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???


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default 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???




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding Ed Excel Programming 7 August 20th 06 01:37 AM
VBA coding nir020 Excel Programming 3 January 17th 06 01:04 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
Need coding help. Neddy[_4_] Excel Programming 6 June 17th 05 12:21 PM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"