View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob[_57_] Bob[_57_] is offline
external usenet poster
 
Posts: 6
Default Macro for selecting random lines

Sorry to be such a nuisance but I am new at Excel macros and have been put
into a situation where I have to get some stuff up and running in a short
time. I was conscripted into a volunteer position and could sure use some
guidance.
I was given a file with a total of 635 lines of questions and a macro
(below) that is supposed to select 100 questions and answers (seperate
documents)

Sub RunRandom()
Range("A2:A635").Select
Selection.Copy
Range("B2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C1:C638").AdvancedFilter Action:=xlFilterInPlace, Unique:= _
True
Range("E2").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom
Range("D2").Select
ActiveCell.FormulaR1C1 = "1"
Range("D3").Select
ActiveCell.FormulaR1C1 = "2"
Range("D2:D3").Select
Selection.AutoFill Destination:=Range("D2:D638"), Type:= _
xlFillDefault
Range("D2:D151").Select
Range("A1").Select
End Sub

My understanding is that the questions are supposed to be printed on one
document and the answers on another.
I intend to buy a book so I don't have to rely on others but could really
use some help until I get a bit of an understanding.
Thanks sincerely
Bob