Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB.NET
Sub ClueBatch()

Dim name As String
Dim room As String
Dim weapon As String
Dim myrow As Integer

Cells(1, 1).Activate
myrow = 1


Do Until IsEmpty(ActiveCell)
DoEvents
name = ActiveCell.Value
room = ActiveCell.Offset(1, 0).Value
weapon = ActiveCell.Offset(2, 0).Value
Cells(myrow, 3).Value = name & "in the" & room & " with the " & weapon & "."

 ActiveCell.End(xlDown).End(xlDown).Activate
 
myrow = myrow + 1

Select Case weapon

Case Is = "Candlestick"
  Range("F2").Value = Range("F2").Value + 1
Case Is = "Dagger"
  Range("F3").Value = Range("F3").Value + 1
Case Is = "Lead Pipe"
  Range("F4").Value = Range("F4").Value + 1
Case Is = "Revolver"
  Range("F5").Value = Range("F5").Value + 1
Case Is = "Rope"
  Range("F6").Value = Range("F6").Value + 1
Case Is = "Wrench"
  Range("F7").Value = Range("F7").Value + 1
End Select

Loop

Range("F2:F7").Select
Range("G2").Value = Range("F2") / WorksheetFunction.Sum(Selection)
Range("G3").Value = Range("F3") / WorksheetFunction.Sum(Selection)
Range("G4").Value = Range("F4") / WorksheetFunction.Sum(Selection)
Range("G5").Value = Range("F5") / WorksheetFunction.Sum(Selection)
Range("G6").Value = Range("F6") / WorksheetFunction.Sum(Selection)
Range("G7").Value = Range("F7") / WorksheetFunction.Sum(Selection)
Range("E10").Value = WorksheetFunction.Min(Selection)



End Sub


What I have tried:

I just want to understand how each thing works in this. What do the functions mean?
Posted
Updated 14-Apr-16 8:07am

1 solution

In conjunction with your other question: What does this mean? What will it do?[^]
We can't explain every last detail of your homework to you: go and read your course notes, get a book and read it, whatever. You need to learn the basics and you clearly haven't.
We arent here to do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

So try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900