View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
M1kehailu M1kehailu is offline
external usenet poster
 
Posts: 5
Default Progress bar & explanation of code

Hello again, I've found some code on the net which is exactly what I need bar
a progress bar. But I've tried and failed in including one in this
example....Is there a way? I got confused because the counter variable is
already being manipulated...and can anyone explain why nothing has been
declared? I have the whole file for anyone who is interested.

Many thanks in advance

M1keHailu

Do While Not IsEmpty(Sheets("return").Cells(1, colr))
colx = getcolumnofselectedcompany(Sheets("return").Cells( 1, colr))
tot = 0
Counter = 0
Application.ScreenUpdating = False

If OptLogRet.Value = True Then
rowx = 3
Do While Not IsEmpty(Sheets("Return").Cells(rowx, 1))
Sheets("Return").Cells(rowx, colr) =
(Log(Sheets("portfolio").Cells(rowx + 1, colx)) -
Log(Sheets("portfolio").Cells(rowx, colx)))
tot = tot + Sheets("Return").Cells(rowx, colr)
Counter = Counter + 1
rowx = rowx + 1
Loop
End If

If OptSimRet.Value = True Then
rowx = 3
Do While Not IsEmpty(Sheets("Return").Cells(rowx, 1))
Sheets("Return").Cells(rowx, colr) =
(Sheets("portfolio").Cells(rowx + 1, colx) - Sheets("portfolio").Cells(rowx,
colx)) / Sheets("portfolio").Cells(rowx, colx)
tot = tot + Sheets("Return").Cells(rowx, colr)
Counter = Counter + 1
rowx = rowx + 1
Loop
End If
Columns(colr).AutoFit

Sheets("Return").Cells(398, colr).Value = tot / Counter

colr = colr + 1
Loop
Application.ScreenUpdating = True