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