#1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Word VBA Code to Excel Code Lee Excel Programming 1 September 24th 04 04:03 AM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"