如何将For循环中的所有值分组并将分组值打印到另一个工作表

时间:2017-07-12 13:10:16

标签: excel vba excel-vba

我需要有关excel vba编程的帮助,我需要在For循环中对值进行分组并将分组列表打印到其他工作表,这是我的代码

Dim grafikas As Worksheet
Dim akcijos As Worksheet
Dim x As Integer
Dim prekeskodas As Long
Dim lastrow As Integer
Dim laikas As Date
Dim ats As String


Set grafikas = Sheets("GRAFIKAS")
Set akcijos = Sheets("AKCIJOS")

lastrow = akcijos.Cells(Rows.Count, 1).End(xlUp).Row
paskeil = grafikas.Cells(Rows.Count, 1).End(xlUp).Row

prekeskodas = grafikas.Range("B48").Value

laikas = grafikas.Range("F1").Value
laikas2 = grafikas.Range("CK1").Value

For x = 2 To lastrow
    If akcijos.Cells(x, 4) = prekeskodas And akcijos.Cells(x, 8) >= laikas Then
       ats = akcijos.Cells(x, 3)
       Sheets("grafikas").Range("C7") = ats
       Debug.Print akcijos.Cells(x, 3)
    End If
Next x

0 个答案:

没有答案
相关问题