View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Daniel CHEN Daniel CHEN is offline
external usenet poster
 
Posts: 16
Default Code assistance needed

try the following code (need some modification):

Sub CopyPasteData()
Dim rngSource As Range, rngDestination As Range
Dim rngAll As Range, rr As Integer, MaxRow As Integer

Set rngAll = ActiveSheet.UsedRange
MaxRow = rngAll.Rows.Count + rngAll(1, 1).Row
Application.ScreenUpdating = False
Set rngSource = Range("A18")
rr = rngSource.Row
While rr <= MaxRow
If rngSource < "" Then
Set rngDestination = Range(rngSource, rngSource.Offset(50, 0))
rngSource.Copy Destination:=rngDestination
Set rngSource = rngSource.Offset(52, 0)
rr = rngSource.Row
End If
Wend
Application.ScreenUpdating = True
End Sub

===== * ===== * ===== * =====
Daniel CHEN


www.Geocities.com/UDQServices
Free Data Processing Add-in<

===== * ===== * ===== * =====

"HJ" wrote in message
...
I would like to create a macro that looks at cell B18, if there is data in
that cell, then copy that data to range A18:A68, then skip 52 rows and
look
at cell B70, if there is data in that cell, then copy that data to range
B70:B120, then skip 52 rows and repeat until there is no data in the cell.

Can someone assist with that code? I have recorded a macro to accomplish
this in the past but now the spreadsheet I have doesn't have a set number
of
rows anymore. I don't think that recording it will assure that I will
always
pick up all data if rows are added.

Thanks again for your help.

HJ