Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Code
Not tested (you posted incomplete code), but try this
Do While ItemCounter < 13 'Sheets("Invoice").Select Windows("Invoice_AND_Total_Sheet.xls").Activate Worksheets("Invoice").Cells(InvoiceSheetItemCntRow , InvoiceSheetItemCntClm).Copy Worksheets("TOTAL SHEET").Cells(TotalSheetItemCntRow, TotalSheetItemCntClm).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 Worksheets("Invoice").Cells(InvoiceSheetTotalsCntR ow, InvoiceSheetTotalsCntClm).Copy Worksheets("TOTAL SHEETS").Range(TotalSheetTotalsCntRow, TotalSheetTotalsCntClm).PasteSpecial _ Paste:=xlValues, _ Operation:=xlNone, _ SkipBlanks:=False, _ Transpose:=False TotalSheetTotalsCntRow = TotalSheetTotalsCntRow + 1 InvoiceSheetTotalsCntRow = InvoiceSheetTotalsCntRow + 1 SaleCounter = SaleCounter + 1 Loop Sheets("Invoice").Select -- HTH RP (remove nothere from the email address if mailing direct) "wtpcomplab" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Word VBA Code to Excel Code | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming |