idnoidno
05-22-2017, 11:57 PM
Sub ta()
Dim mar
Dim i As Integer, n As Integer
Dim rg As Range
Dim sh
Worksheets.Add.Name = "sheet2"
Worksheets("sheet1").Range("a1:s2").Copy
Worksheets("sheet2").Rows(1).Select
Worksheets("sheet2").Paste
With Worksheets("sheet1")
Set rg = .Range("a1").CurrentRegion
mar = rg
n = 3
For i = 3 To UBound(mar)
If (mar(i, 3) > mar(i, 6) And mar(i, 7) * 0.8 > mar(i, 5)) Then
.Rows(i).Copy
Worksheets("sheet2").Select
Rows(n).Select
Worksheets("sheet2").Paste
n = n + 1
End If
Next i
End With
End Sub
Why some elements of array format is string, some double?
Dim mar
Dim i As Integer, n As Integer
Dim rg As Range
Dim sh
Worksheets.Add.Name = "sheet2"
Worksheets("sheet1").Range("a1:s2").Copy
Worksheets("sheet2").Rows(1).Select
Worksheets("sheet2").Paste
With Worksheets("sheet1")
Set rg = .Range("a1").CurrentRegion
mar = rg
n = 3
For i = 3 To UBound(mar)
If (mar(i, 3) > mar(i, 6) And mar(i, 7) * 0.8 > mar(i, 5)) Then
.Rows(i).Copy
Worksheets("sheet2").Select
Rows(n).Select
Worksheets("sheet2").Paste
n = n + 1
End If
Next i
End With
End Sub
Why some elements of array format is string, some double?