View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
mikebres mikebres is offline
external usenet poster
 
Posts: 89
Default Is there a way to skip lines (insert value every other line)

I haven't tried it but it seems that adding the Step 2 should work

a1 = 1
b1 = b
For i = 1 To b Step 2
Worksheets("button to make list").Range("A2").Offset(i - 1, 0).Value = a1
a1 = a1 + 1
Next


"Mike" wrote:



I have a macro that will prompt me with boxes and create a list of numbers
but I am looking for a way to get the macro to put the values into every
other cell. Any help would be great!

Heres what I have so far:

Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
a = InputBox("How many samples?", "How many samples")
b = InputBox("Split where?", "Split after what number?")

a1 = 1
b1 = b
For i = 1 To b
Worksheets("button to make list").Range("A2").Offset(i - 1, 0).Value = a1
a1 = a1 + 1
Next