I have the following code:
Private Sub ChangeAccountNames_Click()
Dim AccountName As String
Dim Rng As Range
Dim InputQuestion As String
Dim i As Integer
Dim s As Worksheet
Set s = Sheets("Essential Info")
i = Cells(3, 9)
Do
Set Rng = Sheets("Essential Info").Range("I2:I13")
InputQuestion = "Please enter in a bank account name: " & vbNewLine & "Click Close once you are done"
AccountName = InputBox(InputQuestion)
Rng.Value = AccountName
i = i + 1
Loop Until i = 10
End Sub
What I need it to do in the following order is:
- Open Inputbox when button is clicked - Done
- Ask the user to enter in an account name - Done
- Store the account name in a string - Done (AccountName Variable)
- Write the AccountName to cell I3 in the sheet "Essential Info"- Kinda works. It inserts to the right sheet but writes it to all cells I3:I13, believe its the Do loop being laid out wrong
- Shift cell I3 down so it now becomes I4 ready for the next name input- Not Functional, need help. Was thinking that I may be able to add 1 cell to a Cells(0,0) variable?
- Only allow the cell to go up to I13 - Working?? Stores this value in i and does count up each loop, it doesn't overshoot.
- Loop back to step 1 until i hits the limit defined OR the user closes the InputBox - It loops but i believe the loop where all my issues lie
There are currently unused variables and really messy bits of info in here that I've added as personal placeholders. Stepthrough seems to behave almost how I need it too but I know this is completely messy