B
Brandon S
My pallet numbering problem...
screenshot- http://img267.yfrog.com/img267/1204/screenshotm.jpg
There is a row for every carton. In column A, each row lists the pallet ID number which is the same for every carton on that pallet, then there are two empty rows and the next pallet ID number starts (actually three empty rows after I insert my subtotals that I need). I need to insert a pallet count that displays five rows up and six columns right. New pallet ID numbers are three rows below previous pallet ID numbers, so this is my "g" variable below. I'm trying to compare "e" to "g" and if they are not the same and "g" is not a blank cell, I want it to print the variable "f," which is my pallet count, five rows up and six columns right
I'm really struggling with this code after much research on the internet. I've had some programming, but none in excel VBA, so I'm sure that my syntax is ugly and/or way off, but I really want to learn this stuff because it interests me.
Sub palletnum()
Dim f As Double
Dim g As Double
f = 0
For Each e In Range("a2:a2000")
g = e.Offset(3, 0)
If ((e.Value <> g.Value) And (g.Value <> 0)) Then
f = f + 1
Range("e.Offset(-5, -1)") = f
End If
Next
End Sub
Anyone that can help me, it would be very, very much appreciated!!
Thanks!
Brandon
EggHeadCafe - Software Developer Portal of Choice
EGGHEADCAFE.COM .NET PROGRAMMING CONTEST
http://www.eggheadcafe.com/tutorial...248-1d4ca1f97869/eggheadcafecom-net-prog.aspx
screenshot- http://img267.yfrog.com/img267/1204/screenshotm.jpg
There is a row for every carton. In column A, each row lists the pallet ID number which is the same for every carton on that pallet, then there are two empty rows and the next pallet ID number starts (actually three empty rows after I insert my subtotals that I need). I need to insert a pallet count that displays five rows up and six columns right. New pallet ID numbers are three rows below previous pallet ID numbers, so this is my "g" variable below. I'm trying to compare "e" to "g" and if they are not the same and "g" is not a blank cell, I want it to print the variable "f," which is my pallet count, five rows up and six columns right
I'm really struggling with this code after much research on the internet. I've had some programming, but none in excel VBA, so I'm sure that my syntax is ugly and/or way off, but I really want to learn this stuff because it interests me.
Sub palletnum()
Dim f As Double
Dim g As Double
f = 0
For Each e In Range("a2:a2000")
g = e.Offset(3, 0)
If ((e.Value <> g.Value) And (g.Value <> 0)) Then
f = f + 1
Range("e.Offset(-5, -1)") = f
End If
Next
End Sub
Anyone that can help me, it would be very, very much appreciated!!
Thanks!
Brandon
EggHeadCafe - Software Developer Portal of Choice
EGGHEADCAFE.COM .NET PROGRAMMING CONTEST
http://www.eggheadcafe.com/tutorial...248-1d4ca1f97869/eggheadcafecom-net-prog.aspx