Y
ytayta555
HI , and a good day to all programmers
I have actually the next macro :
Sub AAACOLUMNS()
Application.ScreenUpdating = True
Dim FromWks1 As Worksheet
Dim DestWks As Worksheet
Dim NextRow As Long
Dim myCell As Range
Dim myRng1 As Range
Dim i1 As Long
Dim i2 As Long
Dim i3 As Long
Dim i4 As Long
Dim i5 As Long
Dim i6 As Long
Dim i7 As Long
Set FromWks1 = Workbooks("DATABASE Gr VALUE.xls").Worksheets("1")
Set DestWks = Workbooks("RAMSES1.xls").Worksheets("1")
With FromWks1
Set myRng1 = .Range("A2000:T2000")
End With
With FromWks1
For i1 = 41 To 50
For i2 = i1 + 1 To 51
For i3 = i2 + 1 To 52
For i4 = i3 + 1 To 53
For i5 = i4 + 1 To 54
For i6 = i5 + 1 To 55
For i7 = i6 + 1 To 56
.Range("A2001:A3635") = .Range(Cells("1", i1), Cells
("1635", i1)).Value
.Range("B2001:B3635") = .Range(Cells("1", i2), Cells
("1635", i2)).Value
.Range("C2001:C3635") = .Range(Cells("1", i3), Cells
("1635", i3)).Value
.Range("D20013635") = .Range(Cells("1", i4), Cells
("1635", i4)).Value
.Range("E2001:E3635") = .Range(Cells("1", i5), Cells
("1635", i5)).Value
.Range("F2001:F3635") = .Range(Cells("1", i6), Cells
("1635", i6)).Value
.Range("G2001:G3635") = .Range(Cells("1", i7), Cells
("1635", i7)).Value
For Each myCell In myRng1.Cells
If myCell.Value = "OK" Then
With FromWks1
.Range("A" & myCell.Row).AutoFill _
Destination:=.Range("A" & myCell.Row & ":G" &
myCell.Row), Type:=xlFillDefault
.Range("A1:A7").Copy
.Range("DA" & myCell.Row & "G" &
myCell.Row).PasteSpecial , Paste:=xlPasteValues, Transpose:=True
End With
Application.CutCopyMode = False
With DestWks
NextRow = .Cells(.Rows.Count, "CY").End(xlUp).Row + 1
myCell.EntireRow.Copy
.Cells(NextRow, "A").PasteSpecial , Paste:=xlPasteValues
End With
Range("CX" & myCell.Row & ":AJ" & myCell.Row).ClearContents
End If
Next myCell
Application.CutCopyMode = False
Next i7
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
End With
Application.ScreenUpdating = True
End Sub
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ __ _
1) What I need now is , to copy and to do autofill in Columns ,
not in Rows ; so , I have myRng1 = .Range("A2000:T2000")
If myCell.Value = "OK" Then _ then to do autofill from
row 2000 & myCell to 3635 & myCell , instead of .........
.... .Range("A" & myCell.Row).AutoFill _
Destination:=.Range("A" & myCell.Row & ":G" & myCell.Row),
Type:=xlFillDefault
Actually , this code do the autofill in myCell.Row
2) After this autofill , the code must copy entire Column (not
Row!) ,
( myCell Column )
and copy it in the second workbook (named "RAMSES1.xls"),
in first column , then in second , from Column A to Column IV
(I use xl 2003) ;
2 a ) When the first worksheet is full (column265) , to copy it in
second
worksheet (named "2") , in column A , and so on ...
It mean , what I need is , what code was done from past time until now
in Rows , to do it in Columns !..!...
Maybe I shall came back later with a last question in my problem ;
Please very much to provide me this changes in this code
I have actually the next macro :
Sub AAACOLUMNS()
Application.ScreenUpdating = True
Dim FromWks1 As Worksheet
Dim DestWks As Worksheet
Dim NextRow As Long
Dim myCell As Range
Dim myRng1 As Range
Dim i1 As Long
Dim i2 As Long
Dim i3 As Long
Dim i4 As Long
Dim i5 As Long
Dim i6 As Long
Dim i7 As Long
Set FromWks1 = Workbooks("DATABASE Gr VALUE.xls").Worksheets("1")
Set DestWks = Workbooks("RAMSES1.xls").Worksheets("1")
With FromWks1
Set myRng1 = .Range("A2000:T2000")
End With
With FromWks1
For i1 = 41 To 50
For i2 = i1 + 1 To 51
For i3 = i2 + 1 To 52
For i4 = i3 + 1 To 53
For i5 = i4 + 1 To 54
For i6 = i5 + 1 To 55
For i7 = i6 + 1 To 56
.Range("A2001:A3635") = .Range(Cells("1", i1), Cells
("1635", i1)).Value
.Range("B2001:B3635") = .Range(Cells("1", i2), Cells
("1635", i2)).Value
.Range("C2001:C3635") = .Range(Cells("1", i3), Cells
("1635", i3)).Value
.Range("D20013635") = .Range(Cells("1", i4), Cells
("1635", i4)).Value
.Range("E2001:E3635") = .Range(Cells("1", i5), Cells
("1635", i5)).Value
.Range("F2001:F3635") = .Range(Cells("1", i6), Cells
("1635", i6)).Value
.Range("G2001:G3635") = .Range(Cells("1", i7), Cells
("1635", i7)).Value
For Each myCell In myRng1.Cells
If myCell.Value = "OK" Then
With FromWks1
.Range("A" & myCell.Row).AutoFill _
Destination:=.Range("A" & myCell.Row & ":G" &
myCell.Row), Type:=xlFillDefault
.Range("A1:A7").Copy
.Range("DA" & myCell.Row & "G" &
myCell.Row).PasteSpecial , Paste:=xlPasteValues, Transpose:=True
End With
Application.CutCopyMode = False
With DestWks
NextRow = .Cells(.Rows.Count, "CY").End(xlUp).Row + 1
myCell.EntireRow.Copy
.Cells(NextRow, "A").PasteSpecial , Paste:=xlPasteValues
End With
Range("CX" & myCell.Row & ":AJ" & myCell.Row).ClearContents
End If
Next myCell
Application.CutCopyMode = False
Next i7
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
End With
Application.ScreenUpdating = True
End Sub
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ __ _
1) What I need now is , to copy and to do autofill in Columns ,
not in Rows ; so , I have myRng1 = .Range("A2000:T2000")
If myCell.Value = "OK" Then _ then to do autofill from
row 2000 & myCell to 3635 & myCell , instead of .........
.... .Range("A" & myCell.Row).AutoFill _
Destination:=.Range("A" & myCell.Row & ":G" & myCell.Row),
Type:=xlFillDefault
Actually , this code do the autofill in myCell.Row
2) After this autofill , the code must copy entire Column (not
Row!) ,
( myCell Column )
and copy it in the second workbook (named "RAMSES1.xls"),
in first column , then in second , from Column A to Column IV
(I use xl 2003) ;
2 a ) When the first worksheet is full (column265) , to copy it in
second
worksheet (named "2") , in column A , and so on ...
It mean , what I need is , what code was done from past time until now
in Rows , to do it in Columns !..!...
Maybe I shall came back later with a last question in my problem ;
Please very much to provide me this changes in this code