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: 1
Default automating data copy from dynamic invoice to single spreadsheet

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.


 
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
Need to copy data from 1 workbook to another based on an invoice # Patty C. Excel Worksheet Functions 3 October 24th 08 10:22 PM
Automating copy-pasting of data values into a new spreadsheet layo mjarantilla Excel Programming 2 December 20th 06 02:22 AM
Dynamic Creation of Invoice number neroamdrid Excel Programming 23 October 12th 06 11:25 AM
Automating to generate the next Invoice No. Murad Sheikh Excel Programming 2 October 10th 05 03:45 PM
How to open another Excel spreadsheet to copy data into current spreadsheet ? Ricky Pang Excel Programming 0 July 13th 03 01:59 PM


All times are GMT +1. The time now is 08:27 AM.

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

About Us

"It's about Microsoft Excel"