View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
hm[_2_] hm[_2_] is offline
external usenet poster
 
Posts: 1
Default constructing a copy-paste loop that skips rows

Hello. Yet another newbie question here.

I am trying to write a macro, starting with A4, copies the text in every
44th row and pastes the text into another worksheet. It should do this for
a user defined number of times. The first cell of interest is A4, the next
would then be A48, etc...

I can't figure out how to construct the loop. I have tried it using Step
(is this right?) and also using variables and Offset. I have gotten so
confused that I don't know what I am doing at this point!

Here is the mess that I have at the moment:

Sub test2()
Dim StartValue As Integer
Dim n As Integer

n = CInt(InputBox("Enter the number of inputs: "))
StartValue = 4
For Count = 1 To n Step 44
ActiveCell.Offset(StartValue, 0).Select
Selection.Copy
Sheets("Sheet2").Activate
ActiveCell(Count, 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Activate
Next Count
End Sub

Any help would be much appreciated!

Thanks,

H.M.