Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
Menu
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
FAQFAQ
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
ProfileProfile
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search

Links
Consulting
Products

Who's Online
[ Administrator ]
[ Moderator ]


Combining case and loop

 
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA
View previous topic :: View next topic  
Author Message
michellez8



Joined: 27 Sep 2009
Posts: 1

PostPosted: Sun Sep 27, 2009 6:09 pm    Post subject: Combining case and loop Reply with quote

Hi!

How can i combine the loop function and case function in VBA

Tons Average No of Categories Credit
1 10 0 0 0
2 20 10 0 0
3 30 20 1 0
4 40 30 2 600
5 50 40 3 1000

i would like to give credits to those who have 20 or above as the average and with 2 or more categories. those with 2 or more get 15 multiplied by the no of tons while more than 2 categories get 20 multiplied by the no of tons. i will not know the exact no of records every day. i got this an example of loop and case

Sub TheSelectCase2()
Dim i As Single
For i = 1
Do While i < 100
Cells(i, 1) = i
i = i + 1

Select Case Range(i, 1).Value

Case 100

Range(i, 1).Value = 50

Case 150

Range(i, 1).Value = 40

Case 200

Range(i, 1).Value = 30

Case 350

Range(i, 1).Value = 20

Case 400

Range(i, 1).Value = 10

End Select
Loop
End Sub

thanks!
Michelle
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group