ajrob
02-08-2009, 09:12 AM
Hoping this is easy ... I'm having a problem setting integer variable Model equal to the value of a cell. I've highlighted the specific section in blue. For background, I'm trying to add labeling based on a specific order of blank and non-blank cells.
Thanks.
Dim Model As Integer
iRow = 7
Do Until iRow = 500
If IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
Model = Cells(iRow, 34)
Select Case Model
Case Model = 15000
Range("B" & iRow).Select
ActiveCell.FormulaR1C1 = "Blue"
Selection.Font.Bold = True
Case Model = 5670
Range("B" & iRow).Select
ActiveCell.FormulaR1C1 = "Red"
Selection.Font.Bold = True
End Select
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = 500
End If
Loop
Thanks.
Dim Model As Integer
iRow = 7
Do Until iRow = 500
If IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
Model = Cells(iRow, 34)
Select Case Model
Case Model = 15000
Range("B" & iRow).Select
ActiveCell.FormulaR1C1 = "Blue"
Selection.Font.Bold = True
Case Model = 5670
Range("B" & iRow).Select
ActiveCell.FormulaR1C1 = "Red"
Selection.Font.Bold = True
End Select
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = False Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = False And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = False And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = iRow + 1
ElseIf IsEmpty(Cells(iRow, 34)) = True And _
IsEmpty(Cells(iRow + 1, 34)) = True And _
IsEmpty(Cells(iRow + 2, 34)) = True Then
iRow = 500
End If
Loop