Thread: Input box code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Input box code

Take a look at using the WOrksheet_selectionchange macro.

Right click on the worksheet tab that you want to add the macro to and
select view code.

You should see a pulldown menu that reads GENERAL. Change it to Worksheet.

Copy this code in

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row Mod 5 < 0 Or Target.Column < 1 Then Exit Sub

CatB = InputBox("Enter Category B value", CatB)
Target.Offset(0, 1).Value = CatB


End Sub

This will give you an input box for every 5th row (5, 10, 15, etc) and
column 1. If you want a different one, modify the IF statement.

Good luck.

"Les" wrote:

Hello

I have a spreadsheet with a blank column waiting to be populated by the user
- let's call it 'category A'.
At let's say every 5th cell going down the column I need an input box to pop
up and ask the user if any of the value he is inputting is 'category B'.
The value entered (even if it is a zero) should then be put in the cell
immediately to the right of the original cell.

Can anyone help please?