View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
nomail1983
 
Posts: n/a
Default VBA code to populate 1000's of cells?

"L. Howard Kittle" wrote:
How can I make 10 a "variable" -- an input or parameter to
the macro or a reference to a cell value?

[....]
Try this change to Bernard's code.
[....]
Dim I As Integer
Dim J As Integer
I = Range("a1").Value
J = Range("a2").Value
Range(ActiveCell, ActiveCell.Offset(rowOffset:=I, _
columnOffset:=J)).Select


Thanks for the hint. To address the purpose implied by
my pseudocode, it is at least as simple as (also correcting
the original off-by-one error):

Dim sz as Integer
sz = Range("A1").Value
if sz <= 1 then sz = 10
Range(ActiveCell, ActiveCell.Offset(rowOffset:=sz-1, [...])

Great stuff! Thanks all for your examples and patience.