View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Brandon S Brandon S is offline
external usenet poster
 
Posts: 6
Default FYI - double post

Sorry for the double post. Please instead answer on the attached subject. I wanted to post it as a new question as to avoid all of the superfluous information above.

http://www.eggheadcafe.com/software/...rn-cannot.aspx



Brandon S wrote:

problem 2
03-Nov-09

Jeez, that was easy. I should have seen that you can subtotal by more then one criteria!


Regarding 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

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
Build C# MSInfo WebService with COM Interop
http://www.eggheadcafe.com/tutorials...webservic.aspx