View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Hmkzoo Hmkzoo is offline
external usenet poster
 
Posts: 1
Default VBA / Macro Help Please

Thanks in advance this is driving me crazy!
I'm trying to create an automated ordering system based on inventory levels.
This is an inventory sheet of 59 items. I have it set to when the total for
a specific product falls underneath a specific level; it displays "order" or
"OK" using:

=IF(AJ3<2,"Order","OK")

The Problem...
I need to post only the items that appear with the "Order" status to another
sheet formatted for export into an existing Access DB. I'm far from an expert
using Macros, The only thing I could come up with is:

Private Sub Worksheet_Activate()

If Worksheets("Count").Range("AK3").Value = "Order" Then
Worksheets("Ordering Export Info").Range("A2").Value = 1 'ID Number
Worksheets("Ordering Export Info").Range("B2").Value = "Air Freshener"
'Product Description
Worksheets("Ordering Export Info").Range("D2").Value = 1 'Preset
Order Amount
Worksheets("Ordering Export Info").Range("E2").Value = Now 'Current Date
End If

If Worksheets("Count").Range("AK4").Value = "Order" Then
Worksheets("Ordering Export Info").Range("A3").Value = 2
Worksheets("Ordering Export Info").Range("B3").Value = "Alkaline"
Worksheets("Ordering Export Info").Range("D3").Value = 2
Worksheets("Ordering Export Info").Range("E3").Value = Now
End If

If Worksheets("Count").Range("AK5").Value = "Order" Then
Worksheets("Ordering Export Info").Range("A4").Value = 3
Worksheets("Ordering Export Info").Range("B4").Value = "Bleach"
Worksheets("Ordering Export Info").Range("D4").Value = 1
Worksheets("Ordering Export Info").Range("E4").Value = Now
End If

End Sub

This, for some reason only prints the first line on the second sheet. It is
not printing any of the other lines. The second and third If statements are
not working for some reason. The other problem with doing it like this is
that there would be gaps in between rows on the second sheet. I'm not sure if
that would affect the export of information to Access or not...Any Ideas???