#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default looping?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default looping?

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default looping?

the macro pulls info from the range "AB3:AL25"
the macro should look for only a specific customer's info
that info is a numeric value greater than zero and located in column "AB"
rows 3 through 25

If "AB" 3 equals zero then the info in row 3 in columns "AB" through "AL"
should be ignored
If "AB" 3 is greater than zero then the info in row 3 "AB" through "AL"
should be copied to a new range destination starting at row 1 "AN" through
"AX" and each subsequent blank row following.

basically what the goal is to create a new range with the elimination of the
rows that contain zero in "AB" 3 through 25 so that info can be transferred
into the customer's worksheet

without having to sort through the production cards by hand, pull out the
specific customer's card, enter the info and to cut and paste into their
worksheet
--
N/K


"nancy/karen" wrote:


--
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

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
Looping maju Excel Programming 9 May 20th 08 07:09 PM
Why is this looping PFS Excel Programming 3 September 3rd 07 01:50 AM
Looping Murph[_2_] Excel Programming 2 August 11th 06 10:45 PM
Looping help please Christy Excel Programming 4 July 14th 06 06:52 PM
looping every third row Jason Hancock Excel Programming 5 July 1st 04 08:00 PM


All times are GMT +1. The time now is 09:39 PM.

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

About Us

"It's about Microsoft Excel"