Hi everyone!
I've got the following code which is meant to find cells with no values, colour the cells in, and then replace the missing value with the average of that column. the average is located in a different sheet
Sub Outliers()
Dim i, j, row, col As Integer
' Prompting messages
col = Application.InputBox _
(Prompt:="Please enter the number of rows ", _
Title:="Row Number", Type:=1)
row = Application.InputBox _
(Prompt:="Please enter the number of colums ", _
Title:="Colum Number", Type:=1)
For i = 1 To row
For j = 1 To col
If IsEmpty(ActiveCell) = True Then
'Copy cell value and paste into cell with missing value
Sheets("Part1DATA").Select
Range("j" & "4").Select
Selection.Copy
Sheets("TrainingData").Select
Range("j" & "i").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Make the cell Red
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 8420607
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
'Move one row down
ActiveCell.Offset(1, 0).Select
Next j
'Move up to the top of the table and across
ActiveCell.Offset(-col, 1).Select
Next i
It throws error 400. However, I have the same code (MissingValues), which colours it all in red, as shown on the file submitted.
The code will later be used to more or less the same extent, except for, it will search for outliers (based on outlier limit) and colouring in the outliers in yellow (hence the name of the sub)
Much appreciate any help!
Kurifodo
Bookmarks