Transfering Data from DATA Sheet 
Author Message
 Transfering Data from DATA Sheet

Hi, I need to know how to transfer data from my data sheet onto individual
invoices.  Each line of the data sheet pertains to a different account.  How do
I get the data to transfer?  I am using Excel 97.  

Thank you,

Jim



Fri, 08 Aug 2003 22:54:26 GMT  
 Transfering Data from DATA Sheet
Jim,

You didn't give many specifics about how  your data is laid out or
how you have constructed your invoices.   Generally you have to
be a little more specific in order to write the code to do something
like this.

One way you might start is to turn on the macro recorder (Tools |
Macro | Record New Macro) and then you can generalize the
code that it writes.   The problem with the code from the
macro recorder is that it will record specific cell addresses as you move
about the workbook, and that is frequently a problem for future use of
the macro.   For example, when you hit the End Down Arrow keys to
go to the end of the range, the macro recorder will record the
address of the last cell in the range rather than the command End Down.
Here is a web page which will help to deal with issues such as this:

http://www.geocities.com/davemcritchie/excel/recorded.htm

If the invoice is a worksheet and a cell in the row has the invoice
number, you could use some code like this to copy the row
to that worksheet:

Sub CopyRow()
Dim SourceRow As Range
Dim Target As Worksheet
Dim TargetRow As Long

'assume sheetname for target sheet is the value of the activecell
Set Target = Worksheets(ActiveCell.Value)
Set SourceRow = ActiveCell.EntireRow
' Find next blank row in TargetSheet - check using Column A
TargetRow = Target.Cells(Rows.Count, 1).End(xlUp).Row + 1
SourceRow.Copy Destination:=Target.Cells(TargetRow, 1)

End Sub

You don't have to copy and paste the entire row.  You can
use the Cells property to be more specific about which cells
to copy and which cell(s) to paste to.

If there are multiple rows to copy, then it is just a matter of writing
a loop to process the desired rows.

HTH,

Brian

Quote:

> Hi, I need to know how to transfer data from my data sheet onto individual
> invoices.  Each line of the data sheet pertains to a different account.  How do
> I get the data to transfer?  I am using Excel 97.

> Thank you,

> Jim



Sat, 09 Aug 2003 00:16:28 GMT  
 Transfering Data from DATA Sheet
use data validation in a cell to allow selecton of which record you want.

This should return a value that uniquely identifies the line.

Then use Index and match to return values from that line.  Match finds the
row

=index(range,match(key value,column in range,0),column number)

Regards,
Tom Ogilvy


Quote:
> Hi, I need to know how to transfer data from my data sheet onto individual
> invoices.  Each line of the data sheet pertains to a different account.
How do
> I get the data to transfer?  I am using Excel 97.

> Thank you,

> Jim



Sat, 09 Aug 2003 09:34:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. transfering data from one work sheet to another

2. transfering data from one sheet to another

3. Request for help transfering data between sheets

4. Checking the row data of First Sheet and deleting the related data from the second sheet

5. finding data on different sheets, and listing that data in a range

6. Copy data based on column info and creat new sheet with Data

7. Count and Copy data based on columns and add data in new sheet

8. HELP: import data from excel97 data sheet to a listbox in a userform of VBA

9. Appending data from txt file to access and exporting data to excell sheet from report

10. BROKEN LINKS BETWEEN DATA SHEET AND DATA LABELS ON COLUMNS AND BARS


 
Powered by phpBB® Forum Software © phpBB Group