LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Copy data from one sheet to another

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?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Excel Discussion (Misc queries) 2 May 15th 10 06:49 AM
Copy Data from Sheet 1 to Empty Cell in Sheet 2 dtoland Excel Programming 2 November 4th 09 06:48 PM
Auto copy cell data from source sheet to another wrkbook sheet IVLUTA Excel Programming 2 June 2nd 09 05:07 PM
How can i copy data from a tabbed working sheet to a summary sheet StephenF Excel Discussion (Misc queries) 1 March 15th 07 03:40 PM
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 parag Excel Worksheet Functions 3 June 15th 06 10:29 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"