Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Counter does not reset, on 2nd trial

Hello

Though my code runs well, if I run it the second time, though I have issued
the statement "counter=0", it starts from the last used value. The code is
like this:

counter = 0
For Each c In Worksheets("Sheet1").Range("A2:A100").Cells
valie = c.Value
If c.Value = 22381 Then
wala = c.Offset(0, 5).Value
If wala = "pills" Then
milla = c.Offset(0, 2).Value
Call file_write
End If
End If
Next c
counter = 0
End Sub

Sub file_write()
Set wkbk = Nothing
On Error Resume Next
Set wkbk = Workbooks("sample-2.xls")
On Error GoTo 0
If wkbk Is Nothing Then
Workbooks.Open FileName:="C:\milinda\sample-2.xls"
End If

Range("E" & counter + 1).Value = milla
Selection.NumberFormat = "#,##0.00"
counter = counter + 1

End Sub

How to cope with this ?

Milind


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


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
Office 2007 trial is very slow. Is this because it's a trial rtappan Excel Discussion (Misc queries) 2 February 22nd 10 10:14 PM
Trial only J Gui Excel Discussion (Misc queries) 1 January 27th 08 11:35 PM
download trial version excel 2003? can only find trial version 200 susan Excel Discussion (Misc queries) 2 November 7th 07 03:19 AM
Trial Has Expired and I can't open spreadsheet created in trial - mls2125 Excel Worksheet Functions 5 July 11th 07 01:24 PM
Reset Counter Ed Excel Discussion (Misc queries) 3 April 14th 06 05:35 PM


All times are GMT +1. The time now is 05:38 AM.

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

About Us

"It's about Microsoft Excel"