View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
GBH99 GBH99 is offline
external usenet poster
 
Posts: 28
Default REpeating Values

Hello,

I have some code that generates Random draw winners, but if a name is
repeated in the list I want to have a pop-up identifing this and ask me if I
want the name changed or kept the same, this is just in case there is only 1
entry with 3 prizes.

I have placed the code below (I know it is messy but this is the only way I
know how to write code)

Please help

Application.Goto Reference:="Random_Number_Generator"
ActiveCell.FormulaR1C1 = "=ROUND((RAND()*(1-" & ValueMAM & ")+" &
ValueMAM & "),0)"
Application.Goto Reference:="MAM_Winner_1"
ActiveCell.FormulaR1C1 =
"=vlookup(Random_Number_Generator,MAMDraw!A:B,2,0) "
SendKeys "{f2}" & "{Enter}", True
Application.Goto Reference:="MAM_Winner_1"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.Goto Reference:="MAM_Winner_2"
ActiveCell.FormulaR1C1 =
"=vlookup(Random_Number_Generator,MAMDraw!A:B,2,0) "
SendKeys "{f2}" & "{Enter}", True
Application.Goto Reference:="MAM_Winner_2"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.Goto Reference:="MAM_Winner_3"
ActiveCell.FormulaR1C1 =
"=vlookup(Random_Number_Generator,MAMDraw!A:B,2,0) "
SendKeys "{f2}" & "{Enter}", True
Application.Goto Reference:="MAM_Winner_3"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False