Need help in data copying.

S

SMILE

Hi
I have an invoicing file in excel (Sheet1). I need to store the dat
which is invoiced into another sheet. My Invoice Data starting from Ro
8 and column B to F (The first item is from B8-F8, second item i
B9-F9). B-Item Code, C-Item Name, D-Qty, E-Price, F-Total.
Once I print the invoice, I need to transfer the data to another shee
(Sheet2) .


When I create another invoice, the new data should be added below t
the previous data in Sheet2. So that I can have all the items I sol
in Sheet2.

Can someone help me sending a macro for it???
I will be grateful to you.
Thanks in advance
Tom
 
D

Dave Peterson

How about something like this (But I'd run it on demand--not automatically):

Option Explicit
Sub testme01()

Dim historyWks As Worksheet
Dim InvWks As Worksheet
Dim destCell As Range

Set InvWks = Worksheets("Invoice")
Set historyWks = Worksheets("Log")

With historyWks
Set destCell = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0)
End With

With InvWks
.Range("b8", .Range("b8").End(xlDown)).Resize(, 5).Copy
End With
destCell.PasteSpecial Paste:=xlPasteValues

End Sub


It assumes that column B in Invoice is always used and you want it pasted into
column B of the Log worksheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top