Thread: Autofill
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Autofill

Is this what you mean

Sub Macro1()
Range("B1:B20").Value = "Random 1"
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"paulinoluciano" wrote in message
ups.com...
"Is there some VBA code with which could I autofill the column B with
some formula exactly with the same size in A while this could be
variable among the sheets?"
I have used the code:

Sub Macro1()
Range("B1").Select
ActiveCell.FormulaR1C1 = "Random 1"
Selection.AutoFill Destination:=Range("B1:B20")
End Sub

But in this case I have the fills with the words Random 1, Random 2,
Random 3,... Random 20. The problem is that in other situations the
random numbers could be 1000 or more and I would not like to do that
manually.