Thread: Looping
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
anderssweden anderssweden is offline
external usenet poster
 
Posts: 8
Default Looping

I am making a program that finds a cell and then checks the cells belonging
to same column. I am having trouble with the loop. I want to check the cells
and see if they are empty. If they are the loop is to be terminated and the
number of rows "belonging" to the loop shall be saved so that I know the
length of the list. However I do not know how to write the loop properly. I
am very thankful for any fast assistance. My code so far is:

Private Sub findValue2()
Dim rng As Range
Dim findVal As String
Dim i As Integer
Dim list As Integer
Set rng = Worksheets("Dimension").Cells.Find("qc", LookIn:=xlValues)
Worksheets("Indata").Range("K1") = rng.Address
rad = rng.Row
kolumn = rng.Column
i = 0
Do Until rng.Value < ""
Cells(rng.Row + i, rng.Column) = i
i = i + 1
list = list + 1