macro help

G

Guest

I wrote a macro that calls for input from the user. the macro aska series of
4 questions and then inserts them in the next available row. I need my macro
to look for the value input from the user on the first question. basically
the first question will ask what is your hfc number, i want the macro to then
search the sheet in column a for that value, if that val;ue is not in there
then it will proceed witht he rest,however if the macro finds that same
number then i want it to go to a serises of different questions to change the
information to th previous hfc. is there an "if" function of some nature to
do such a thing?
 
G

Guest

Some detail from the macro would be helpful. How do you get the info from
the user? Inputbox?
Are you familiar with the "If" statement in Visual Basic? If not, use
Visual Basic Help. Also, look at "Select Case".
 
G

Guest

Public Sub getdata()
Dim nextrow As Long
Dim entry1 As String, entry2 As String, entry3 As String
Dim entry4 As String

Do
nextrow = Range("A65536").End(xlUp).Row + 1
entry1 = InputBox("What is the HFC MAC?")
If entry1 = "" Then Exit Sub
entry2 = InputBox("What kind of modem is it?")
If entry2 = "" Then Exit Sub
entry3 = InputBox("Where is the modem?")
If entry3 = "" Then entry3 = "Shevled"
entry4 = InputBox("What's the status of the modem: Renting, Purchased or
Pending")
If entry4 = "" Then entry4 = "Pending"
Cells(nextrow, 1) = entry1
Cells(nextrow, 2) = entry2
Cells(nextrow, 3) = entry3
Cells(nextrow, 4) = entry4
Loop

End Sub

thats what the macro looks like...after the user inputs the adata collected
for entry1 i want the macro to search the previous entries for that one then
promt other questions but if its not in there then is will insert the data to
the next empty row
 

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