Selecting a cell
Another option...
Select A:E (headers in Row 1 only).
Data|Form
You can click the criteria button
search for your Item number
tab to the correct field and type the new number you want.
==========
But if you want a cheap and dirty macro...
Option Explicit
Sub testme()
Dim FoundCell As Range
Dim FindWhat As String
Dim HowMany As Long
HowMany = 3
With Worksheets("sheet1")
Do
FindWhat = InputBox(Prompt:="Item Number?")
If Trim(FindWhat) = "" Then Exit Do
With .Range("a:a")
Set FoundCell = .Cells.Find(what:=FindWhat, _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, searchorder:=xlByRows, _
searchdirection:=xlNext)
End With
If FoundCell Is Nothing Then
Beep
MsgBox "Not found!"
Else
HowMany = Application.InputBox(Prompt:="How Many for: " _
& FoundCell.Address(0, 0), _
Default:=HowMany, Type:=1)
If HowMany < 1 Then Exit Do
FoundCell.Offset(0, 4).Value = HowMany
End If
Loop
End With
End Sub
It quits when you hit cancel for either inputbox. And it remembers the previous
quantity--if you don't like that, change the default to what you use the most.
olenavychief wrote:
I used to be a pretty fair BASIC Programmer, but I haven't been able to
devote enough time to learn VBA for Office, I've never done anything that
needed it before. I'm sure this is a really easy one, but I'm really a newbie
to this, so any help would be appreciated.
Here is the situation:
I am trying to post inventory into an excel spreadsheet so that I can import
it into a custom label program to print price & description barcoded labels.
I export the inventory from my accounting program directly into an Excel
workbook, no problem there. Only 4 columns are exported:
"ItemNum" "Desc" "QuanOnHand" "Price"
I add a column heading "NumLabels" so that I know how many labels of any
particular item need printing. This is always the 5th column.
Then using my received inventory's packing slips I can search for the item
numbers, tab over to the "NumLabels" column and enter how many labels to
print.
Here's the problem - that's a LOT of typing! I CTRL-F to get the Find
Dialogue, type the item number I'm looking for, click search, close the Find
Dialogue, tab right 4 cells, type the number of labels - then CTRL-F etc. etc.
I'v tried recording a MACRO a zillion times, but it doesn't capture the
correct keypresses, so no go.
Ideally, I'd like to hit a key, have a find dialogue pop-up, type the item
number, find it, and when closed, automatically tab 4 spaces so I may enter
the number of labels, then open the find dialogue again, basicly a loop until
I type CTRL-X or something to stop it. Can this be done?
--
Dave Peterson
|