View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Deepak Varde Deepak Varde is offline
external usenet poster
 
Posts: 6
Default need help in the code

in the below I am unable to get the for next loops to recall the inputs
stored in a String variable.

My below code works, but it takes the last value of the string and proceeds.
I want it to ask the same questions for all the stored string values.
Could you provide me the solution?

My code :

Dim groupamount
Dim groupname As String
Dim i As Long
Dim d As Long

' This section Gets Group Names

groupamount = InputBox("how many groups have you made?")
ActiveCell.Offset(4, 2).Insert
If groupamount < "" Then
For i = 1 To groupamount
groupname = InputBox("what is the name of your group " & i)
ActiveCell.Offset(i, 0).Value = groupname
Next i
d = groupamout - 1
End If

' This section captures Threats
Dim Threatnumber
Dim increase As Long
Dim threatname As String
Dim decrease As Long

Threatnumber = InputBox("How many threats do you foresee for " & groupname &
" group?")

If Threatnumber < "" Then
For increase = 1 To Threatnumber
threatname = InputBox("what is the name of your " & increase & "
threat?")
ActiveCell.Offset(8, 4).Insert
ActiveCell.Offset(increase, 4).Value = threatname
Next increase
End If