LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default automating data copy from dynamic invoice to single spreadsheet

Sub dd() 'Look at the bottom row and dim as long for the row.

Dim rngData As Range,
rngDest As Long
Dim i as integer ' may need double or long?
dim j As Integer ' may need double or long?
rngDest = Sheets("InvData").Cells(Rows.Count, 1).End(xlUp).Row + 1
End Sub

Also, you may be able to copy blocks and delete blanks instead of one cell
at a time.
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"apaul" wrote in message
...
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 02:23 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"