LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Counter stops working

I have been using the following code to add items from one worksheet to
another in a specific row and column. I have used this code for a few years.
Recently when editing in Excel 2007 (compatability mode) the counter stops
working. ie it always puts the data in row 7 instead of counting down one row
for each additional item.Does any one have any ideas on what has changed or
is there a better way to control where the copied data is placed.

Sub FordRetail()
'<<RETAIL
On Error Resume Next
Dim WkSht As Worksheet
Dim Counter As Long
Dim RowCount As Long
Dim i As Object, Y As Object

Set WkSht = Sheets("Calculator")

r$ = Trim(Str(ActiveCell.Row))
Counter = 7
Do While Not Range("Ford2007.xls!A" & Counter).Value = ""
Counter = Counter + 1
Loop
'<< <your code to initialize counter

For Each i In Selection.Areas
RowCount = RowCount + i.Rows.Count
Next i

'<<If Counter <=18Then '<< Maybe S/B Counter
If RowCount <= 26 Then '<<??????
For Each Y In Selection
WkSht.Cells(Counter, 1).Value = Cells(Y.Row, 2).Value
'<<Cells(Row,Column) B;A Vehicle
WkSht.Cells(Counter, 4).Value = Cells(Y.Row, 1).Value '<<Code
WkSht.Cells(Counter, 2).Value = _
Cells(Y.Row, 3).Value + Cells(Y.Row, 4).Value + Cells(Y.Row,
5).Value '<<RRP No LCT

WkSht.Cells(Counter, 12).Value = _
Cells(Y.Row, 3).Value + Cells(Y.Row, 4).Value + Cells(Y.Row,
5).Value '<<RRP No LCT

WkSht.Cells(Counter, 7).Value = Cells(Y.Row, 5).Value '<<MARGIN

Counter = Counter + 1
Next Y

Else
MsgBox "Too Many Items", vbExclamation, "Quotemaster"
End If

End Sub

Cheers

Alan
 
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
IF just STOPS WORKING Gee Excel Worksheet Functions 21 August 6th 09 05:26 PM
VBA Stops Working egun Excel Programming 2 January 29th 09 02:13 PM
VB Code stops working Michelle K Excel Programming 17 August 17th 07 05:58 PM
VBA Stops Working? Marty Excel Programming 4 February 16th 05 05:27 PM
Worksheet_SelectionChange stops working jlr_nz Excel Programming 2 November 8th 03 09:08 PM


All times are GMT +1. The time now is 08:02 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"