Thread: looping?
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
nancy/karen nancy/karen is offline
external usenet poster
 
Posts: 9
Default looping?


--
N/K


"Joel" wrote:

You code doesn't make a lot of sense. The code below is structured a lot
better then your original code but I couldn't figure out what you were doing
so the code below probably doesn't work.

Sub Button12_Click()
Dim d1 As Variant
Dim h1 As Variant
Dim m1 As Variant
Dim i As Integer, c As Integer, k As Integer
c = 28
k = 1
For i = 3 To 25
d1 = Sheets("daily production").Cells(i, c)
If d1 < 0 Then
Sheets("daily production").Range("ab" & i & ":al" & i).Copy _
Destination:=Sheets("daily production").Range("an" & k & ":ax" &
k)
End If
If d1 = 0 Then


d1 = Sheets("daily production").Cells(i, c).Value

h1 = Sheets("daily production").Cells(c, i + 1).Value

m1 = Sheets("daily production").Cells(c + 10, k + 1).Value

End If
k = k + 1
Next i


End Sub




"nancy/karen" wrote:

Hello!

I have a production worksheet that information is entered into it on a daily
basis. The information is gathered but used in two seperate worksheets. I
have a macro set up for all of the general production totals in one of the
seperate sheets. I want to take specific customer data from the entered info
and place in the other worksheet without having to sort production cards or
cut and paste.

I came up with the following macro unfortunately, as it is it only gathers
the information from the first row of the worksheet. I cannot figure out
what I am doing incorrectly that it won't go to the next row? Please help my
eyes are crossed and my brain is unwilling to take another day of the pain!

Sub Button12_Click()
Dim d1 As Variant
Dim h1 As Variant
Dim m1 As Variant
Dim i As Integer, c As Integer, k As Integer
c = 28
k = 0
i = 3
d1 = Sheets("daily production").Cells(i, c)
d1 = Sheets("daily production").Cells(i, c).Value
If d1 < 0 Then
Sheets("daily production").Range("an1.ax1") = Sheets("daily
production").Range("ab3.al3").Value
If d1 = 0 Then

For i = 3 To 25
Next i
i = i + 1

d1 = Sheets("daily production").Cells(i + 1, c).Value

h1 = Sheets("daily production").Range("ab3.al3").Value
h1 = Sheets("daily production").Cells(c, 3).Value
h1 = Sheets("daily production").Cells(c, i + 1).Value

m1 = Sheets("daily production").Range("an1.ax1").Value
m1 = Sheets("daily production").Cells(c + 10, k + 1).Value

If m1 < "" Then
k = k + 1

Do Until i = 25
Loop

End If
End If
End If
End Sub



--
N/K