Advertisement
Guest User

Untitled

a guest
Nov 8th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.44 KB | None | 0 0
  1. Private Sub CommandButton5_Click()
  2. With Worksheets(1).Range("f4:f1500") 'sets range to work in
  3.  
  4. inpoot = UCase(InputBox("what filter would you like to add?")) 'pops up dialogue box asking for filter number and makes that number = inpoot
  5. Set c = .Find(inpoot, LookIn:=xlValues) 'makes c equal found cell containing "inpoot"[filternumber]
  6.    
  7.     If c Is Nothing Then 'if nothing is found it adds it to the bottom of the row and asks for shelf number and how many there are
  8.     Range("f4").End(xlDown).Offset(1, 0).Select 'goes to the bottom of the column and selects next empty cell
  9. ActiveCell.Value = inpoot
  10. ActiveCell.Offset(0, 1) = InputBox("what shelf is it on")
  11. ActiveCell.Offset(0, 2) = InputBox("how man do you have")
  12. Me.CommandButton5.Activate
  13.         SendKeys " " 'lazy way of looping
  14.          ElseIf ActiveCell.Offset(0, 1) = Empty Then ' basically if c is something but cell next to it is empty it asks for the shelf
  15.          ActiveCell.Offset(0, 1) = InputBox("what shelf is it on")
  16.          Me.CommandButton5.Activate
  17.          SendKeys " " 'lazy loop
  18.        
  19.        
  20.         Else
  21.       c.Offset(0, 2).Activate 'if c has a value and cell next to it[shelf] is populated it just asks how many filters there are
  22.      
  23.      
  24.       ActiveCell.Value = InputBox("how many do you have") 'changes the qty column value to what ever you type in
  25.       Me.CommandButton5.Activate
  26.       SendKeys " " 'lazy loop
  27.      End If
  28.      
  29.  
  30. End With
  31. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement