Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to copy cells one row up then move down 4 rows & repeat

I have a downloaded report that does not have data on one row. I need to
copy 5 cols. of data from one row to the row above then move 4 rows down and
repeat. I've done this with Lotus years ago, but never with Excel

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to copy cells one row up then move down 4 rows & repeat

If you mean you want to remove all blank rows in a report

Sub RemoveRows()
On Error Resume Next
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
On Error goto 0
End Sub

--
Regards,
Tom Ogilvy

"Josef" wrote in message
...
I have a downloaded report that does not have data on one row. I need to
copy 5 cols. of data from one row to the row above then move 4 rows down

and
repeat. I've done this with Lotus years ago, but never with Excel

Thanks,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Macro to copy cells one row up then move down 4 rows & repeat

Josef,
Assuming you know where to start and when to stop, here's
an example that starts at row 2 and loops 3 times.
Geof.
Sub testcopy()

Dim lngCounter As Long
Dim lngCurrentRow As Long
Dim lngTotal As Long

lngCurrentRow = 2
lngTotal = 3

For lngCounter = 1 To lngTotal
Range("A" & lngCurrentRow, "E" &
lngCurrentRow).Copy Destination:=Range("A" &
lngCurrentRow).Offset(-1, 0)
lngCurrentRow = lngCurrentRow + 4
Next lngCounter

End Sub
-----Original Message-----
I have a downloaded report that does not have data on one

row. I need to
copy 5 cols. of data from one row to the row above then

move 4 rows down and
repeat. I've done this with Lotus years ago, but never

with Excel

Thanks,
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to copy cells one row up then move down 4 rows & repeat

Geof,

Thanks, it worked like great. I guess you can't copy macros into the macro
editor? I retyped it and worked.

Thanks again

"Geof Wyght" wrote:

Josef,
Assuming you know where to start and when to stop, here's
an example that starts at row 2 and loops 3 times.
Geof.
Sub testcopy()

Dim lngCounter As Long
Dim lngCurrentRow As Long
Dim lngTotal As Long

lngCurrentRow = 2
lngTotal = 3

For lngCounter = 1 To lngTotal
Range("A" & lngCurrentRow, "E" &
lngCurrentRow).Copy Destination:=Range("A" &
lngCurrentRow).Offset(-1, 0)
lngCurrentRow = lngCurrentRow + 4
Next lngCounter

End Sub
-----Original Message-----
I have a downloaded report that does not have data on one

row. I need to
copy 5 cols. of data from one row to the row above then

move 4 rows down and
repeat. I've done this with Lotus years ago, but never

with Excel

Thanks,
.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to copy cells one row up then move down 4 rows & repeat

Josef,
You're welcome. You should be able to copy & paste the
code. It might have some junk. I commented out many
statements. Longer lines had carriage returns when posted
You might have had the goofy characters.
Geof.
-----Original Message-----
Geof,

Thanks, it worked like great. I guess you can't copy

macros into the macro
editor? I retyped it and worked.

Thanks again

"Geof Wyght" wrote:

Josef,
Assuming you know where to start and when to stop,

here's
an example that starts at row 2 and loops 3 times.
Geof.
Sub testcopy()

Dim lngCounter As Long
Dim lngCurrentRow As Long
Dim lngTotal As Long

lngCurrentRow = 2
lngTotal = 3

For lngCounter = 1 To lngTotal
Range("A" & lngCurrentRow, "E" &
lngCurrentRow).Copy Destination:=Range("A" &
lngCurrentRow).Offset(-1, 0)
lngCurrentRow = lngCurrentRow + 4
Next lngCounter

End Sub
-----Original Message-----
I have a downloaded report that does not have data on

one
row. I need to
copy 5 cols. of data from one row to the row above

then
move 4 rows down and
repeat. I've done this with Lotus years ago, but

never
with Excel

Thanks,
.


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro - how to move to a specific cell and repeat andrea Excel Worksheet Functions 7 August 19th 08 12:39 AM
repeat two rows macro please jwmbem New Users to Excel 3 March 9th 08 04:02 PM
copy a worksheet to new one with repeat rows 5 times mfn Excel Discussion (Misc queries) 0 February 13th 08 11:33 AM
macro to copy cells to intermittent rows in a spreadsheet BROCK8292 Excel Discussion (Misc queries) 5 September 21st 07 10:28 PM
Macro to copy cells to rows below [email protected] Excel Discussion (Misc queries) 1 January 20th 06 06:59 PM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"