I have a annual meeting calender. In this calender different meetings are booked in different colors. (eg. sales, marketing, HR, Finance)
For every department meeting is booked in every month.
To view only one meeting at a time on click a have this formula.
This formula works fine but it takes to much time to search in all months because of while-wend. Is there any way I can speed up the process on Click?
Help please!!!!!
Sub SM()
Dim LRow As Integer
Dim Lcell As String
Dim Lce As String
Dim LColorCells As String
Dim lac As String
Lce = "S"
LRow = 4
lac = "S66"
Lcell = Lce & LRow
While Lcell <> lac
While LRow < 66
Lcell = Lce & LRow
LColorCells = Lcell
Select Case Left(Range(Lcell).Value, 4)
Case "SM"
Range(LColorCells).Interior.ColorIndex = 4
Range(LColorCells).Interior.Pattern = xlSolid
Case Else
Rows(LRow & ":" & LRow).Select
Range(LColorCells).Interior.ColorIndex = xlNone
End Select
LRow = LRow + 1
Wend
If LColorCells = "S65" Then
LRow = 4
Lce = "T"
lac = "T66"
End If
If LColorCells = "T65" Then
LRow = 4
Lce = "W"
lac = "W66"
End If
If LColorCells = "W65" Then
LRow = 4
Lce = "X"
lac = "X66"
End If
If LColorCells = "X65" Then
LRow = 4
Lce = "AA"
lac = "AA66"
End If
If LColorCells = "AA65" Then
LRow = 4
Lce = "AB"
lac = "AB66"
End If
If LColorCells = "AB65" Then
LRow = 4
Lce = "AE"
lac = "AE66"
End If
If LColorCells = "AE65" Then
LRow = 4
Lce = "AF"
lac = "AF66"
End If
If LColorCells = "AF65" Then
LRow = 4
Lce = "AI"
lac = "AI66"
End If
If LColorCells = "AI65" Then
LRow = 4
Lce = "AJ"
lac = "AJ66"
End If
If LColorCells = "AJ65" Then
LRow = 4
Lce = "AM"
lac = "AM66"
End If
If LColorCells = "AM65" Then
LRow = 4
Lce = "AN"
lac = "AN66"
End If
If LColorCells = "AN65" Then
LRow = 4
Lce = "AQ"
lac = "AQ66"
End If
If LColorCells = "AQ65" Then
LRow = 4
Lce = "AR"
lac = "AR66"
End If
If LColorCells = "AR65" Then
LRow = 4
Lce = "AU"
lac = "AU66"
End If
If LColorCells = "AU65" Then
LRow = 4
Lce = "AV"
lac = "AV66"
End If
If LColorCells = "AV65" Then
LRow = 4
Lce = "AY"
lac = "AY66"
End If
If LColorCells = "AY65" Then
LRow = 4
Lce = "AZ"
lac = "AZ66"
End If
If LColorCells = "AZ65" Then
LRow = 4
Lce = "BC"
lac = "BC66"
End If
If LColorCells = "BC65" Then
LRow = 4
Lce = "BD"
lac = "BD66"
End If
If LColorCells = "BD65" Then
LRow = 4
Lce = "BG"
lac = "BG66"
End If
If LColorCells = "BG65" Then
LRow = 4
Lce = "BH"
lac = "BH66"
End If
If LColorCells = "BH65" Then
LRow = 4
Lce = "BK"
lac = "BK66"
End If
If LColorCells = "BK65" Then
LRow = 4
Lce = "BL"
lac = "BL65"
End If
Wend
Range("A1").Select
End Sub
For every department meeting is booked in every month.
To view only one meeting at a time on click a have this formula.
This formula works fine but it takes to much time to search in all months because of while-wend. Is there any way I can speed up the process on Click?
Help please!!!!!
Sub SM()
Dim LRow As Integer
Dim Lcell As String
Dim Lce As String
Dim LColorCells As String
Dim lac As String
Lce = "S"
LRow = 4
lac = "S66"
Lcell = Lce & LRow
While Lcell <> lac
While LRow < 66
Lcell = Lce & LRow
LColorCells = Lcell
Select Case Left(Range(Lcell).Value, 4)
Case "SM"
Range(LColorCells).Interior.ColorIndex = 4
Range(LColorCells).Interior.Pattern = xlSolid
Case Else
Rows(LRow & ":" & LRow).Select
Range(LColorCells).Interior.ColorIndex = xlNone
End Select
LRow = LRow + 1
Wend
If LColorCells = "S65" Then
LRow = 4
Lce = "T"
lac = "T66"
End If
If LColorCells = "T65" Then
LRow = 4
Lce = "W"
lac = "W66"
End If
If LColorCells = "W65" Then
LRow = 4
Lce = "X"
lac = "X66"
End If
If LColorCells = "X65" Then
LRow = 4
Lce = "AA"
lac = "AA66"
End If
If LColorCells = "AA65" Then
LRow = 4
Lce = "AB"
lac = "AB66"
End If
If LColorCells = "AB65" Then
LRow = 4
Lce = "AE"
lac = "AE66"
End If
If LColorCells = "AE65" Then
LRow = 4
Lce = "AF"
lac = "AF66"
End If
If LColorCells = "AF65" Then
LRow = 4
Lce = "AI"
lac = "AI66"
End If
If LColorCells = "AI65" Then
LRow = 4
Lce = "AJ"
lac = "AJ66"
End If
If LColorCells = "AJ65" Then
LRow = 4
Lce = "AM"
lac = "AM66"
End If
If LColorCells = "AM65" Then
LRow = 4
Lce = "AN"
lac = "AN66"
End If
If LColorCells = "AN65" Then
LRow = 4
Lce = "AQ"
lac = "AQ66"
End If
If LColorCells = "AQ65" Then
LRow = 4
Lce = "AR"
lac = "AR66"
End If
If LColorCells = "AR65" Then
LRow = 4
Lce = "AU"
lac = "AU66"
End If
If LColorCells = "AU65" Then
LRow = 4
Lce = "AV"
lac = "AV66"
End If
If LColorCells = "AV65" Then
LRow = 4
Lce = "AY"
lac = "AY66"
End If
If LColorCells = "AY65" Then
LRow = 4
Lce = "AZ"
lac = "AZ66"
End If
If LColorCells = "AZ65" Then
LRow = 4
Lce = "BC"
lac = "BC66"
End If
If LColorCells = "BC65" Then
LRow = 4
Lce = "BD"
lac = "BD66"
End If
If LColorCells = "BD65" Then
LRow = 4
Lce = "BG"
lac = "BG66"
End If
If LColorCells = "BG65" Then
LRow = 4
Lce = "BH"
lac = "BH66"
End If
If LColorCells = "BH65" Then
LRow = 4
Lce = "BK"
lac = "BK66"
End If
If LColorCells = "BK65" Then
LRow = 4
Lce = "BL"
lac = "BL65"
End If
Wend
Range("A1").Select
End Sub