I would like to input my stock according to item number.
A4 to A1000 are my stock items.
Cell D is my balance.
I would like to create a macro where I can Ctrl F to find the stock
number but apon pressing Enter such as Stock item #42 which would
appear at say A149 to go directly to D149.
Thanks,
Rube
Sub Macro1()
Dim ans
Dim cell As Range
ans = InputBox(quot;Supply search stringquot;)
If ans lt;gt; False Then
Set cell = Cells.Find(What:=ans, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not cell Is Nothing Then
cell.Offset(0, 4).Select
End If
End If
End Sub--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
quot;Rubixquot; gt; wrote in message
...
gt; I would like to input my stock according to item number.
gt;
gt; A4 to A1000 are my stock items.
gt;
gt; Cell D is my balance.
gt;
gt; I would like to create a macro where I can Ctrl F to find the stock
gt; number but apon pressing Enter such as Stock item #42 which would
gt; appear at say A149 to go directly to D149.
gt;
gt; Thanks,
gt; Rube
gt;
gt;
Thanks Bob this is what I'm looking for. However my stock numbers
range from 2 to 6 didgets. How can I insert code to go to Enter Entire
Cell Content. Right now if I go to 8888 for example then to 42 I get
the next item with a 42 in it such as 554260 or the price in column B.
On Wed, 8 Mar 2006 09:23:46 -0000, quot;Bob Phillipsquot;
gt; wrote:
gt;Sub Macro1()
gt;Dim ans
gt;Dim cell As Range
gt; ans = InputBox(quot;Supply search stringquot;)
gt; If ans lt;gt; False Then
gt; Set cell = Cells.Find(What:=ans, _
gt; After:=ActiveCell, _
gt; LookIn:=xlFormulas, _
gt; LookAt:=xlPart, _
gt; SearchOrder:=xlByRows, _
gt; SearchDirection:=xlNext, _
gt; MatchCase:=False, _
gt; SearchFormat:=False)
gt; If Not cell Is Nothing Then
gt; cell.Offset(0, 4).Select
gt; End If
gt; End If
gt;End SubSub Macro1()
Dim ans
Dim cell As Range
ans = InputBox(quot;Supply search stringquot;)
If ans lt;gt; False Then
Set cell = Cells.Find(What:=ans, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
If Not cell Is Nothing Then
cell.Offset(0, 4).Select
End If
End If
End Sub--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
quot;Rubixquot; gt; wrote in message
...
gt; Thanks Bob this is what I'm looking for. However my stock numbers
gt; range from 2 to 6 didgets. How can I insert code to go to Enter Entire
gt; Cell Content. Right now if I go to 8888 for example then to 42 I get
gt; the next item with a 42 in it such as 554260 or the price in column B.
gt;
gt; On Wed, 8 Mar 2006 09:23:46 -0000, quot;Bob Phillipsquot;
gt; gt; wrote:
gt;
gt; gt;Sub Macro1()
gt; gt;Dim ans
gt; gt;Dim cell As Range
gt; gt; ans = InputBox(quot;Supply search stringquot;)
gt; gt; If ans lt;gt; False Then
gt; gt; Set cell = Cells.Find(What:=ans, _
gt; gt; After:=ActiveCell, _
gt; gt; LookIn:=xlFormulas, _
gt; gt; LookAt:=xlPart, _
gt; gt; SearchOrder:=xlByRows, _
gt; gt; SearchDirection:=xlNext, _
gt; gt; MatchCase:=False, _
gt; gt; SearchFormat:=False)
gt; gt; If Not cell Is Nothing Then
gt; gt; cell.Offset(0, 4).Select
gt; gt; End If
gt; gt; End If
gt; gt;End Sub
gt;
Thanks again Bob, I realized I had to make change to the After string
to Range A1. Works like a charm. I may ask to help make my monthly
database a lot more simplified than the method I am using now.
Currently I have a worksheet made for each day of the month. What I'd
really like to do is have all the days on one worksheet.
Day 1 would be on cell.Offset(0, 4).Select - Day 2 would be on 0, 6
(2 cells per day). Rather than editing macro below to change
cell.Offset I would like to create another macro function to go to a
certain day say Day 2 which is Column F,G then remain in cell F until
day is changed.
Hope this makes sense. If not I can live with what I have until I
decide to learn more about macros.
Rube
On Thu, 9 Mar 2006 10:46:26 -0000, quot;Bob Phillipsquot;
gt; wrote:
gt;Sub Macro1()
gt;Dim ans
gt;Dim cell As Range
gt; ans = InputBox(quot;Supply search stringquot;)
gt; If ans lt;gt; False Then
gt; Set cell = Cells.Find(What:=ans, _
gt; After:=ActiveCell, _
gt; LookIn:=xlFormulas, _
gt; LookAt:=xlWhole, _
gt; SearchOrder:=xlByRows, _
gt; SearchDirection:=xlNext, _
gt; MatchCase:=False, _
gt; SearchFormat:=False)
gt; If Not cell Is Nothing Then
gt; cell.Offset(0, 4).Select
gt; End If
gt; End If
gt;End Sub
- Jun 22 Fri 2007 20:38
Create macro
close
全站熱搜
留言列表
發表留言