Updating cells using input boxes

G

gdbm

Hi all

My problem is that i am using Input boxes to update a spreadsheet. I
have two coloums i want to update for two diffent type of information.
I am currently trying to use


Sub Compfees()


MyInput = InputBox("Enter Students Name")
Range("Sheet1!N20").End(xlDown).Offset(1, 0).Value = MyInput


MyInput = InputBox("Enter Fee")
Range("Sheet1!O20").End(xlDown).Offset(1, 0).Value = MyInput


End Sub


But this seems to update the first colum ok and move down updating as
required, but it just replaces the value in the second coloum and
doesn't move down.


Hope you can help


Cheers


Glynn
 
D

Dave Peterson

I think I'd pick out one of those columns and use that to determine the next
row.

Sub Compfees()
dim NextRow as long

with worksheets("sheet1")
nextrow = .range("N20").end(xldown).offset(1,0).row

MyInput = InputBox("Enter Students Name") = MyInput
.cells(nextrow,"N").value = myInput

MyInput = InputBox("Enter Fee")
.cells(nextrow,"O").value = myInput

end with

End Sub
 
D

Don Guillett

modify this idea to suit
Sub getinput()
With Sheets("sheet7")
lr = .Range("h1").End(xlUp).Row + 1
..Cells(lr, "H").Value = InputBox("Enter Fee")
End With
End Sub
 
G

gdbm

Dave said:
I think I'd pick out one of those columns and use that to determine the next
row.

Sub Compfees()
dim NextRow as long

with worksheets("sheet1")
nextrow = .range("N20").end(xldown).offset(1,0).row

MyInput = InputBox("Enter Students Name") = MyInput
.cells(nextrow,"N").value = myInput

MyInput = InputBox("Enter Fee")
.cells(nextrow,"O").value = myInput

end with

End Sub

Hi Dan

I have tried your solution and it does update the rows as i needed but
the first value i input in coloum N just comes out as False.

Thanks for your help so far.

Cheers

Glynn
 
D

Dave Peterson

Sorry, there was a typo.

Change this line:
MyInput = InputBox("Enter Students Name") = MyInput
to
MyInput = InputBox("Enter Students Name")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top