I have no clue about how to use vba

  • Thread starter Thread starter amy howell
  • Start date Start date
A

amy howell

Here is what I have to accomplish and I do not know how to do it. It is
based on a worksheet. Can someone help me?

Public Sub FlagQuotas()
Dim rngActiveCell As Range
Dim blnExhibition As Boolean
Dim blnRegSeason As Boolean
Dim blnPlayoffs As Boolean
' FOR SECTION 4...
' DECLARE YOUR 4 TICKET HOLDER NAME VARIABLES HERE.
' USE "DIM" STATEMENTS FOR THIS PROCESS.


' Clear the range of tickets sold of any formats.
Range("TicketsSold").ClearFormats

' FOR SECTION 4...
' INITIALIZE YOUR 4 TICKET HOLDER NAME VARIABLES HERE. ASSIGN THEM A
VALUE
' OF 0.
' USE 4 ASSIGNMENT STATEMENTS FOR THIS PROCESS.


' Loop through the tickets sold range. Examine each cell, one
' at a time. Determine its ticket type using its row number.
For Each rngActiveCell In Range("TicketsSold")
Select Case rngActiveCell.Row
Case 4, 7, 10, 13
blnExhibition = True
blnRegSeason = False
blnPlayoffs = False
Case 5, 8, 11, 14
blnExhibition = False
blnRegSeason = True
blnPlayoffs = False
Case 6, 9, 12, 15
blnExhibition = False
blnRegSeason = False
blnPlayoffs = True
Case Else
MsgBox "Error in rngActiveCell.Row." & _
"Value of rngActiveCell.Row: " & _
rngActiveCell.Row
Exit Sub
End Select

' Now that we know the active cell's ticket type, check to see if it's
' equal or greater than its designated quota.
' Exhibition...
If blnExhibition = True Then
If rngActiveCell.Value >= Range("ExhibQuota") Then
rngActiveCell.Interior.Color = vbYellow
' FOR SECTION 4...
' DETERMINE THE CURRENT TICKET HOLDER USING THE
' rngActiveCell.Column PROPERTY IN A SELECT CASE STATEMENT.
' KNOWING THE COLUMN TELLS YOU WHICH TICKET HOLDER'S VARIABLE
' YOU NEED TO ADD 1 TO.
' USE A SELECT CASE STATEMENT HERE THAT REFERS TO THE
' rngActiveCell.Column PROPERTY. NOTE THAT THIS VALUE WILL
' BE A NUMBER, NOT A LETTER (i.e. - "Jack M." uses column D,
but
' the Column property returns 4).

GoTo LoopingMarker
End If
End If
' Regular season...
If blnRegSeason = True Then
If rngActiveCell.Value >= Range("RegQuota") Then
rngActiveCell.Interior.Color = vbYellow
' FOR SECTION 4...
' DETERMINE THE CURRENT TICKET HOLDER USING THE
' rngActiveCell.Column PROPERTY IN A SELECT CASE STATEMENT.
' KNOWING THE COLUMN TELLS YOU WHICH TICKET HOLDER'S VARIABLE
' YOU NEED TO ADD 1 TO.
' USE A SELECT CASE STATEMENT HERE THAT REFERS TO THE
' rngActiveCell.Column PROPERTY. NOTE THAT THIS VALUE WILL
' BE A NUMBER, NOT A LETTER (i.e. - "Jack M." uses column D,
but
' the Column property returns 4).

GoTo LoopingMarker
End If
End If
' Playoffs...
If blnPlayoffs = True Then
If rngActiveCell.Value >= Range("PlayQuota") Then
rngActiveCell.Interior.Color = vbYellow
' FOR SECTION 4...
' DETERMINE THE CURRENT TICKET HOLDER USING THE
' rngActiveCell.Column PROPERTY IN A SELECT CASE STATEMENT.
' KNOWING THE COLUMN TELLS YOU WHICH TICKET HOLDER'S VARIABLE
' YOU NEED TO ADD 1 TO.
' USE A SELECT CASE STATEMENT HERE THAT REFERS TO THE
' rngActiveCell.Column PROPERTY. NOTE THAT THIS VALUE WILL
' BE A NUMBER, NOT A LETTER (i.e. - "Jack M." uses column D,
but
' the Column property returns 4).

GoTo LoopingMarker
End If
End If
LoopingMarker:
' Return to the beginning of the loop to get the next active cell in
' the range of tickets sold.
Next

' FOR SECTION 4...
' INDIVIDUALLY ASSIGN EACH OF THE TICKET HOLDER NAME VARIABLES TO ITS
' CORRESPONDING ROW 16 CELL (i.e. - Assign the variable for "Jack M."
' to D16).
' USE 4 ASSIGNMENT STATEMENTS FOR THIS PROCESS.


' FOR SECTION 4...
' ADD UP ALL 4 OF THE TICKET HOLDER NAME VARIABLES AND CONCATENATE THE
' TOTAL TO THE BELOW MsgBox STATEMENT. RECALL THAT CONCATENATING STRINGS
' IS PEFORMED USING "&". SEE THE ABOVE MsgBox STATEMENT AS AN EXAMPLE.
MsgBox "Processing completed! The total count of MBE cells was: "
End Sub
 
Hi Kim! I know this is an old thread, but I too am having this issue. Were you able to figure it out?
 
Back
Top