• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to input values in the next cell and so on without using any loop?

shahin

Active Member
I'm trying to figure out how to place values after the last input and so on when there is no loop. Offset property might be a good option for this but i can't use it in the right way to get things done. The way I've written the below macro can handle inputs and place it in its right position (in the next cell) if the first two rows are already filled in. Range("A1") can be considered as header. What if Range("A2") is yet to b filled in? If Range("A2") is not filled in by-default and i try to execute my macro giving anything as input then the macro throws an error "Application-defined or Object-defined Error" However, my goal is to input any values to the inputbox and the macro will be able to put those values serially from Range("A2") to whatever without using any loop.

Code:
Sub input_item()
    Dim Myval As Variant
    Range("A1") = "Item Names"
    Range("A2") = "shahin"

    Myval = InputBox("Give me any input")
    Range("A1").End(xlDown).Offset(1, 0).Select
    ActiveCell.Value = Myval
End Sub
 
Back
Top