S
Slim Slender
Here is my procedure. It quite doesn't work.
Public Sub CopyRecordsfromDatatoDatabase()
Dim myArray(7)
Dim myColumn As Integer, myRow As Single
Dim i As Integer
myRow = 2
i = 1
Do
For myColumn = 6 To 26
Worksheets("data").Activate
With ActiveSheet
.Cells(myRow, 5) = myArray(1)
.Cells(myRow, 3) = myArray(2)
.Cells(myRow, 2) = myArray(3)
.Cells(1, myColumn) = myArray(4)
.Cells(myRow, myColumn) = myArray(5)
.Cells(myRow + 1, myColumn) = myArray(6)
.Cells(myRow + 2, myColumn) = myArray(7)
End With
Worksheets("Database").Activate
With ActiveSheet
i = i + 1
.Range(.Cells(i, 1), .Cells(i, 7)) = myArray
End With
Next myColumn
myRow = myRow + 3
Worksheets("data").Activate
Loop Until Cells(myRow, 1).Value <> ""
End Sub
It cuts all the data from the first ("data") sheet which is okay
except for one item I need to be copied repeatedly (Cells(1,
myColumn)).
It does not copy/write to the second sheet at all because the array is
not being populated, but it does overwrite the appropriate cells on
the second ("Database") sheet with nothing.
Once I get the array to populate, I would need to empty or reset it
after each loop, wouldn't I?
Public Sub CopyRecordsfromDatatoDatabase()
Dim myArray(7)
Dim myColumn As Integer, myRow As Single
Dim i As Integer
myRow = 2
i = 1
Do
For myColumn = 6 To 26
Worksheets("data").Activate
With ActiveSheet
.Cells(myRow, 5) = myArray(1)
.Cells(myRow, 3) = myArray(2)
.Cells(myRow, 2) = myArray(3)
.Cells(1, myColumn) = myArray(4)
.Cells(myRow, myColumn) = myArray(5)
.Cells(myRow + 1, myColumn) = myArray(6)
.Cells(myRow + 2, myColumn) = myArray(7)
End With
Worksheets("Database").Activate
With ActiveSheet
i = i + 1
.Range(.Cells(i, 1), .Cells(i, 7)) = myArray
End With
Next myColumn
myRow = myRow + 3
Worksheets("data").Activate
Loop Until Cells(myRow, 1).Value <> ""
End Sub
It cuts all the data from the first ("data") sheet which is okay
except for one item I need to be copied repeatedly (Cells(1,
myColumn)).
It does not copy/write to the second sheet at all because the array is
not being populated, but it does overwrite the appropriate cells on
the second ("Database") sheet with nothing.
Once I get the array to populate, I would need to empty or reset it
after each loop, wouldn't I?