View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
niloyparvaz niloyparvaz is offline
external usenet poster
 
Posts: 2
Default problem using excel function in vba

Hi

I have just been working on vba for the last 2 days only so please pardon my
lack of understanding of even the very basic terms

Basically, I have made an excel sheet where I have automated a process of
copying a specific range of rows from sheet 1 to different sheets using for
loop. everytime the loop finishes, it moves onto the next column to copy the
values again. This goes on when I press the start timer button

Ideally what I want to do is when I press the stop timer button, my code
should automatically move onto the next column and do a calculation
(variance) of all the previous column that was being copied before i pressed
the stop button.


Sub Insert_Formula()
Call IncrementCounter
For i = 3 To 53
If IsEmpty(Cells(i, GetCounter())) Then
Worksheets("USD").Cells(i, GetCounter()).Formula = "=VAR(B3:GetCounter-1)"
End If
Next i
End Sub

What I am doing is first incrementing my column and checking whether it is
empty.Counter is how I defined my columns as and I am very aware of the fact
that the way I have written the code above is not the way to do it. So could
you please tell me how to go about pursuing this?

Please tell me if you need more details to help me out. Thanks