本文介绍了这是关于批处理的另一个问题:这是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

推荐答案


这篇关于这是关于批处理的另一个问题:这是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 19:38