Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi - I am a newbie vis-a-vis VBA. I am trying to copy data off of an invoice
(that keeps changing every day) to a single spreadsheet. So far, I have used the following code: Sub CopyCells() Dim rngData As Range, rngDest As Range Dim i, j As Integer Set rngData = Sheets("Invoice").Range("A16:g35") Set rngDest = Sheets("InvData").Range("A1").End(xlDown).Offset(1 , 0) For i = 1 To rngData.Rows.Count If rngData.Cells(i, 1) < "" Then rngDest.Offset(j, 0).Value = Sheets("Invoice").Range("b8").Value rngDest.Offset(j, 1).Value = Sheets("Invoice").Range("b10").Value rngDest.Offset(j, 2).Value = rngData.Cells(i, 1).Value rngDest.Offset(j, 3).Value = rngData.Cells(i, 2).Value rngDest.Offset(j, 4).Value = rngData.Cells(i, 3).Value rngDest.Offset(j, 5).Value = rngData.Cells(i, 4).Value rngDest.Offset(j, 6).Value = rngData.Cells(i, 6).Value rngDest.Offset(j, 7).Value = Sheets("Invoice").Range("b9").Text j = j + 1 End If Next End Sub Now every time I run it, I keep getting the following error: Run-time error '1004' Application-defined or object-defined error. Any help would be highly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to copy data from 1 workbook to another based on an invoice # | Excel Worksheet Functions | |||
Automating copy-pasting of data values into a new spreadsheet layo | Excel Programming | |||
Dynamic Creation of Invoice number | Excel Programming | |||
Automating to generate the next Invoice No. | Excel Programming | |||
How to open another Excel spreadsheet to copy data into current spreadsheet ? | Excel Programming |