View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jim hensen[_4_] jim hensen[_4_] is offline
external usenet poster
 
Posts: 1
Default coping rows using a loop... please advise




Hello everyone i have a problem with a macro i am creating. There i
probably a really easy answer to this question, but i cant figure i
out. I need to know how to only copy the 4 rows following the cel
that contains "station number". These rows then need to be paste
into a new worksheet. This process must be done 12 times per wor
sheet. There are 12 cells containing the text "station number" and
need the 4 rows after each one. There are also numerous worksheet
that need to be procecced in the same manner. If anyone could help i
would be greatly appreciated.

P.S. I managed to create the code shown below. I dont know how muc
of it is correct. This is my first attempt at writing a macro :)


Dim Snum As Integer
Dim xi As Integer

Snum = 0
xi = 0
If (BSnum = STATION_NAME) Then
Range("B" & Snum :"BI" & (Snum + 3)").Select
Selection.Copy
Sheets("Sheet1").Select
Range("B" & xi).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
xi = xi + 4
Else
Snum = Snum + 1
End I

--
jim hense
-----------------------------------------------------------------------
jim hensen's Profile: http://www.excelforum.com/member.php...fo&userid=1515
View this thread: http://www.excelforum.com/showthread.php?threadid=26889