Thread: Excel Code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wtpcomplab wtpcomplab is offline
external usenet poster
 
Posts: 16
Default Excel Code

Working on code for a spreadsheet and keep getting error on the code.
Need to switch back and forth between Worksheet s and do some cut and past.
Use the code below and it error out on the worksheet function.
It works fine on the same command prior to this section of code but will not
work here.
Please advise.

Thanks Dan



Do While ItemCounter < 13

'Sheets("Invoice").Select
' CODE ERROR
Windows("Invoice_AND_Total_Sheet.xls").Activate
Worksheets("Invoice").Cells(InvoiceSheetItemCntRow ,
InvoiceSheetItemCntClm).Select ' INVOICE ITEM 1 to 12
Selection.Copy
Worksheets("TOTAL SHEET").Cells(TotalSheetItemCntRow,
TotalSheetItemCntClm).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
TotalSheetItemCntRow = TotalSheetItemCntRow + 1
InvoiceSheetItemCntRow = InvoiceSheetItemCntRow + 1
ItemCounter = ItemCounter + 1
Loop

' SALES TOTALS

Do While SaleCounter < 6

'Sheets("Invoice").Select
' SALES TOTALS 1 to 5
' CODE ERROR
Worksheets("Invoice").Cells(InvoiceSheetTotalsCntR ow,
InvoiceSheetTotalsCntClm).Select
Selection.Copy
'Sheets("TOTAL SHEET").Select
Worksheets("TOTAL SHEETS").Range(TotalSheetTotalsCntRow,
TotalSheetTotalsCntClm).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
TotalSheetTotalsCntRow = TotalSheetTotalsCntRow + 1
InvoiceSheetTotalsCntRow = InvoiceSheetTotalsCntRow + 1
SaleCounter = SaleCounter + 1
Loop
Sheets("Invoice").Select