View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brice Brice is offline
external usenet poster
 
Posts: 21
Default Add record to end of list, variables table

I currently have (script below) macro which adds a record (from "CashEntry"
sheet, cells $C$2:$P$3) to the bottom of a list (on another sheet
""CashTransferRecord") .

My Request: I would now like the ability to add the record to one of four
different sheets (instead of solely the "CashTransferRecord") based on a
Variables Table (see below). So, the macro will identify the Name located in
'CashEntry" cell G2, then add the record to bottom of list onto the
appropriate Sheet Name.

Variables Table:

Names Sheet Name
Robert RobertCash
Dilbert DilbertCash
Q-Bert Q-BertCash
Eggbert EggbertCash


__________________________________
Sub CopyPasteOntoDatabase()

Sheets("CashTransferRecord").Select
If Cells(2, 3).Value = Empty Then
Worksheets("CashEntry").Range("$C$2:$P$3").Copy
Worksheets("CashTransferRecord").Range("C2").Paste Special (xlPasteValues)
Else
Worksheets("CashEntry").Range("$C$2:$P$3").Copy
Worksheets("CashTransferRecord").Range("C65000").E nd(xlUp).Offset(1,
0).Cells.PasteSpecial (xlPasteValues)
End If

End Sub