Good afternoon.
I am creating a script that will upload a .csv file into Excel, name the uploaded data as a range, typically the month, this is then averaged with a high and low values assigned, typically +/_ 5 of the average respectivly.
I will then apply a format blue for higher than average values, red for lower.
Getting this to function with one set of values to apply the condition to is no problem. Given the condition rules chmage on a monthly basis I have tried various methods if statement, case and so on the latest attempt is shown below
Private Sub CommandButton1_Click()
Dim rng
Dim cell As Range
Dim selectedRng As String
Dim High
Dim Low
selectedRng = InputBox("Enter your range")
Set rng = Range(selectedRng)
Select Case selectedRng
Case October
Range("o63").Value = High
Range("o62").Value = Low
Case November
Range("r63").Value = High
Range("r62").Value = Low
Case December
Range("v63").Value = High
Range("v62").Value = Low
End Select
For Each cell In rng
If Value > High Then
cell.Font.ColorIndex = 5
ElseIf Value < Low Then
cell.Font.ColorIndex = 3
End If
Next cell
End Sub
All it does is colour the text blue - pointer etc will be gratfully received
Regards
I am creating a script that will upload a .csv file into Excel, name the uploaded data as a range, typically the month, this is then averaged with a high and low values assigned, typically +/_ 5 of the average respectivly.
I will then apply a format blue for higher than average values, red for lower.
Getting this to function with one set of values to apply the condition to is no problem. Given the condition rules chmage on a monthly basis I have tried various methods if statement, case and so on the latest attempt is shown below
Private Sub CommandButton1_Click()
Dim rng
Dim cell As Range
Dim selectedRng As String
Dim High
Dim Low
selectedRng = InputBox("Enter your range")
Set rng = Range(selectedRng)
Select Case selectedRng
Case October
Range("o63").Value = High
Range("o62").Value = Low
Case November
Range("r63").Value = High
Range("r62").Value = Low
Case December
Range("v63").Value = High
Range("v62").Value = Low
End Select
For Each cell In rng
If Value > High Then
cell.Font.ColorIndex = 5
ElseIf Value < Low Then
cell.Font.ColorIndex = 3
End If
Next cell
End Sub
All it does is colour the text blue - pointer etc will be gratfully received
Regards