Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with inputbox cel reference
The input box routine below does exactly what I want it to - but only on the
first line. I want to modify it so it works on every row. The cell references of b, j & K remain the same but the line reference varies. How do I set it up so it knows what line it's on? I'm a newbie so some extra explanation is helpful. Thanks! ActiveSheet.Unprotect Range("b63").Select ActiveCell = "x" mynum = Application.InputBox("Payment including Adj") Range("j63").Value = mynum mynum = Application.InputBox("Enter total overpayment remaining") Range("k63").Value = mynum ActiveSheet.Protect |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with inputbox cel reference
Janet,
Some clarification may be needed, namely what you mean by wanting the macro to work on every row. I will assume that you want to be able to run the macro on whatever line you are currently on. If this is the case, you won't need the Range("B63").Select command. To find out the current line (row) that the macro is on use the following: ActiveCell.Row You can also simplify your code by assigning the InputBox statements directly to a cell value rather than first assigning it to a variable and then assigning that variable to the cell. Putting all of this together you end up with the following: ActiveSheet.Unprotect Range("B" & ActiveCell.Row) = "x" Range("J" & ActiveCell.Row) = Application.InputBox("Payment including Adj") Range("K" & ActiveCell.Row) = Application.InputBox("Enter total overpayment remaining") ActiveSheet.Protect Hope this helps. -Cory |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with inputbox cel reference
Dim cell as Range
ActiveSheet.Unprotect for each cell in Range("B63:B50") cell.Select ActiveCell = "x" mynum = Application.InputBox("Payment including Adj") Cells(cell.row,"J").Value = mynum mynum = Application.InputBox("Enter total overpayment remaining") cells(cell.row,"k").Value = mynum Next ActiveSheet.Protect -- Regards, Tom Ogilvy "Janet H" wrote in message ... The input box routine below does exactly what I want it to - but only on the first line. I want to modify it so it works on every row. The cell references of b, j & K remain the same but the line reference varies. How do I set it up so it knows what line it's on? I'm a newbie so some extra explanation is helpful. Thanks! ActiveSheet.Unprotect Range("b63").Select ActiveCell = "x" mynum = Application.InputBox("Payment including Adj") Range("j63").Value = mynum mynum = Application.InputBox("Enter total overpayment remaining") Range("k63").Value = mynum ActiveSheet.Protect |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with inputbox cel reference
Awesome! Thanks
"Cory" wrote: Janet, Some clarification may be needed, namely what you mean by wanting the macro to work on every row. I will assume that you want to be able to run the macro on whatever line you are currently on. If this is the case, you won't need the Range("B63").Select command. To find out the current line (row) that the macro is on use the following: ActiveCell.Row You can also simplify your code by assigning the InputBox statements directly to a cell value rather than first assigning it to a variable and then assigning that variable to the cell. Putting all of this together you end up with the following: ActiveSheet.Unprotect Range("B" & ActiveCell.Row) = "x" Range("J" & ActiveCell.Row) = Application.InputBox("Payment including Adj") Range("K" & ActiveCell.Row) = Application.InputBox("Enter total overpayment remaining") ActiveSheet.Protect Hope this helps. -Cory |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
InputBox Help | Excel Discussion (Misc queries) | |||
InputBox | Excel Discussion (Misc queries) | |||
InputBox | Excel Programming | |||
Inputbox and Application.InputBox | Excel Programming | |||
inputbox | Excel Programming |