Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox Help Mark[_8_] Excel Discussion (Misc queries) 2 November 24th 08 11:07 PM
InputBox GeorgeJ Excel Discussion (Misc queries) 5 July 12th 07 01:20 AM
InputBox smandula Excel Programming 7 July 28th 05 08:33 AM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
inputbox defj Excel Programming 4 November 26th 03 10:25 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"