N
nhanh
Hi,
I'm trying to use the Do loop in my coding but am getting no where.
I have already prompted the user with an input box asking for thei
name.
I have a list of names in sheet2
My aim is to start at the beginning of the list and move down th
column one cell at a time until i reach an empty cell. When I get t
the empty cell, i want input the new name that the user has jus
inputed.
Currently i have:
Public Sub AddNames()
Worksheets("Sheet1").Select
Range("B2").Select
Dim FirstName As String
FirstName = InputBox("What is your firstname?", "First Name")
ActiveWorkbook.Worksheets("sheet1").Range("B2").Value = FirstName
Dim SurName As String
SurName = InputBox("What is your surname?", "Surname Name")
ActiveWorkbook.Worksheets("sheet1").Range("B2").Offset(0, 1).Value
SurName
Worksheets("Sheet2").Select
Range("A2").Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Value = FirstName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SurName
Exit Do
Loop
I am sure there is something wrong with the coding after "D
Untill...". Any help would be REALLY appreciated. Thank
I'm trying to use the Do loop in my coding but am getting no where.
I have already prompted the user with an input box asking for thei
name.
I have a list of names in sheet2
My aim is to start at the beginning of the list and move down th
column one cell at a time until i reach an empty cell. When I get t
the empty cell, i want input the new name that the user has jus
inputed.
Currently i have:
Public Sub AddNames()
Worksheets("Sheet1").Select
Range("B2").Select
Dim FirstName As String
FirstName = InputBox("What is your firstname?", "First Name")
ActiveWorkbook.Worksheets("sheet1").Range("B2").Value = FirstName
Dim SurName As String
SurName = InputBox("What is your surname?", "Surname Name")
ActiveWorkbook.Worksheets("sheet1").Range("B2").Offset(0, 1).Value
SurName
Worksheets("Sheet2").Select
Range("A2").Select
Do Until IsEmpty(ActiveCell)
ActiveCell.Value = FirstName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SurName
Exit Do
Loop
I am sure there is something wrong with the coding after "D
Untill...". Any help would be REALLY appreciated. Thank