کد PHP:
Sub Macro1()
Application.ScreenUpdating = False
Dim vote As Range
Dim room As Integer
Dim i As Integer
Dim TotalVote(30) As Integer
Dim cel As String
Sheets("Orginal").Select
room = Range("D2").Value
If room = 0 Then GoTo a
For Each vote In Range("C5:G35")
If vote.Value = 1 Then
TotalVote(vote.row - 5) = vote.Column - 2
End If
Next vote
Sheets("result").Select
Range("O" & room) = Range("O" & room) + 1
For i = 0 To 30
If TotalVote(i) <> 0 Then
cel = Cells(i + 3, TotalVote(i) + 9)
If cel = "" Then
cel = room
ElseIf Not findroom(Cells(i + 3, TotalVote(i) + 9), room) Then
cel = cel & "-" & room
End If
Cells(i + 3, TotalVote(i) + 9) = cel
End If
Cells(i + 3, TotalVote(i) + 9) = sortedarray(Cells(i + 3, TotalVote(i) + 9))
Next i
a:
Call colorise
Sheets("Orginal").Select
Range("A2:G35").Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.count)
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Sheets("Orginal").Select
Range("D2").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("F2").Select
Selection.ClearContents
Range("G2").Select
Selection.ClearContents
Range("C5:G35").Select
Selection.ClearContents
Range("D2").Select
ActiveWorkbook.Save
Application.ScreenUpdating = True
End Sub
علاقه مندی ها (Bookmarks)