Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Can anyone help me to do the following please?

  Asked By: Lorraine    Date: Oct 18    Category: MS Office    Views: 419
  

I'll be
to others as I'm quite new to vba & don't know an awful lot about it.
I've already found some interesting & useful stuff on your site, just
installed ASAP utilities & it looks very good. I have a feeling I wont
know how I managed in the past in a few weeks time.

Can anyone help me to do the following please?

I've been using input boxes to make it quicker to add data to a spread
sheet; no problems there. I want to ask the user how many operations
there are so that, if they say 5, they will only get prompted to enter 5
lots of data into operations column, alternatively, could I put in the
option in the input box to cancel after say 5 entries & then jump to the
next line in the macro.

Thanks for any help I receive, I'm sure it's a doddle once you know what
you're doing.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Pearl Garza     Answered On: Oct 18

For Counter = 1 to 5
strValue = InputBox("What value?", "Input Box")
Next Counter

You could even have the 5 be a value which is collected by an input  box.

 
Answer #2    Answered By: Finn Jones     Answered On: Oct 18

Once I understood what was happening & with a bit
of twiddling I've got it to do exactly what I want. Here's a snippet
below.

x = InputBox("How many Operations are there?")

For Counter = 1 To x

Range("A11").Select

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False).Activate

p = InputBox("Name of Operation?", "Input Box")

ActiveCell.FormulaR1C1 = p

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

l = InputBox("Labour cost; quantity per hour?", "Input Box")

ActiveCell.FormulaR1C1 = l

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

m = InputBox("Labour cost; cost per hour?", "Input Box")

ActiveCell.FormulaR1C1 = m

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

pr = InputBox("Production Overheads; quantity per hour?", "Input Box")

ActiveCell.FormulaR1C1 = pr

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

prcph = InputBox("Production Overheads; cost per hour?", "Input Box")

ActiveCell.FormulaR1C1 = prcph

Next Counter

 
Didn't find what you were looking for? Find more on Can anyone help me to do the following please? Or get search suggestion and latest updates.




Tagged: