Thread
:
Macro for selecting random lines
View Single Post
#
2
Posted to microsoft.public.excel.programming
Tushar Mehta
external usenet poster
Posts: 1,071
Macro for selecting random lines
Not that answering these questions guarantees a satisfactory resolution
to your problem, but...
What are the contents of A:E before you run the macro?
What is the purpose of the macro? What is the intent behind each of
the major operations (AdvancedFilter, Sort, AutoFill) in the macro?
What do you need help with?
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
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
Reply With Quote
Tushar Mehta
View Public Profile
Find all posts by Tushar Mehta