I tried to work with macros that should
- sort p-values in column H
- delete all the rows with p-values
>=0.05 - fill column I with "B - E", I mean
I2=B2-E2;I3=B3-E3et cetera - sort by column I
This macros was created by Jeeped:
Sub sort1()
Dim m As Variant
With ActiveSheet
'delete rows 1:6
.Range("1:6").EntireRow.Delete Shift:=xlUp
'new column header for column I
Range("I1") = "diff"
'sort A:I on column H (ascending)
With .Range("A:I")
.Sort Key1:=.Columns(8), Order1:=xlAscending, Header:=xlYes
End With
'find >=0.05
m = Application.Match(0.05, .Range("H:H"), 0)
If IsError(m) Then m = Application.Match(0.05, .Range("H:H"))
'delete rows (>=0.05):<bottom of worksheet>
.Range(.Cells(m, "A"), .Cells(.rows.Count, "A")).EntireRow.Delete Shift:=xlUp
'new formula for column I data range
.Range("I2:I" & m - 1).FormulaR1C1 = "=RC[-7]-RC[-4]"
'calculate (actually unnecessary, putting in new formulas forces true calculation)
.Calculate
'sort A:I on column I (ascending)
With .Range("A:I")
.Sort Key1:=.Columns(9), Order1:=xlAscending, Header:=xlYes
End With
End With
End Sub
It worked before but now it stops on the string
.Range(.Cells(m, "A"), .Cells(.rows.Count, "A")).EntireRow.Delete Shift:=xlUp
It says
Run-time error '13': Type mismatch
Please help!