Advertisement
Guest User

Untitled

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