Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default In VBA, bump to next row each iteration

I am a VBA novice. I've created VBA code by recording Excel macros. I have a
macro that copies cells from one worksheet and pastes them into another in
the same workbook. I want to run the macro repeatedly and have each
successive row in the target worksheet start one row below the previous one.
I can pick up the row number from the source worksheet if that would help.
But I don't know how to convert it into a row number in the target worksheet
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default In VBA, bump to next row each iteration

Show your code.

Tim

"Chuck M" wrote in message
...
I am a VBA novice. I've created VBA code by recording Excel macros. I have
a
macro that copies cells from one worksheet and pastes them into another in
the same workbook. I want to run the macro repeatedly and have each
successive row in the target worksheet start one row below the previous
one.
I can pick up the row number from the source worksheet if that would help.
But I don't know how to convert it into a row number in the target
worksheet



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default In VBA, bump to next row each iteration

Code supplied below. It is the Range("D2").Select line that i'd like to
change into soemthing dynamic. I.E. The next time this macro executes, I'd
like the active cell (target ot the PasteSpecial) to be D3, then D4, etc.

Sub Process4()
Range("A13:A16").Select
Selection.Copy
Sheets("Work Area").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Range("A5").Select
End Sub

"Tim Williams" wrote:

Show your code.

Tim

"Chuck M" wrote in message
...
I am a VBA novice. I've created VBA code by recording Excel macros. I have
a
macro that copies cells from one worksheet and pastes them into another in
the same workbook. I want to run the macro repeatedly and have each
successive row in the target worksheet start one row below the previous
one.
I can pick up the row number from the source worksheet if that would help.
But I don't know how to convert it into a row number in the target
worksheet




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default In VBA, bump to next row each iteration

chuck:

try something like this. change the name of the sheet you're copying from (i
used sheet1 in the code). i assumed there was a heading in D1.

Sub Process4()
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim lastrow As Long

Set ws = Worksheets("Sheet1")
Set ws2 = Worksheets("Work Area")
lastrow = ws2.Cells(Rows.Count, "D").End(xlUp).Offset(1).Row
ws.Range("A13:A16").Copy

ws2.Range("D" & lastrow).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Range("A5").Select
End Sub

--


Gary


"Chuck M" wrote in message
...
Code supplied below. It is the Range("D2").Select line that i'd like to
change into soemthing dynamic. I.E. The next time this macro executes, I'd
like the active cell (target ot the PasteSpecial) to be D3, then D4, etc.

Sub Process4()
Range("A13:A16").Select
Selection.Copy
Sheets("Work Area").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Range("A5").Select
End Sub

"Tim Williams" wrote:

Show your code.

Tim

"Chuck M" wrote in message
...
I am a VBA novice. I've created VBA code by recording Excel macros. I have
a
macro that copies cells from one worksheet and pastes them into another in
the same workbook. I want to run the macro repeatedly and have each
successive row in the target worksheet start one row below the previous
one.
I can pick up the row number from the source worksheet if that would help.
But I don't know how to convert it into a row number in the target
worksheet






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default In VBA, bump to next row each iteration

Gary,
Thank you so much! It definitely looks like this is going to work for me.

"Gary Keramidas" wrote:

chuck:

try something like this. change the name of the sheet you're copying from (i
used sheet1 in the code). i assumed there was a heading in D1.

Sub Process4()
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim lastrow As Long

Set ws = Worksheets("Sheet1")
Set ws2 = Worksheets("Work Area")
lastrow = ws2.Cells(Rows.Count, "D").End(xlUp).Offset(1).Row
ws.Range("A13:A16").Copy

ws2.Range("D" & lastrow).PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Range("A5").Select
End Sub

--


Gary


"Chuck M" wrote in message
...
Code supplied below. It is the Range("D2").Select line that i'd like to
change into soemthing dynamic. I.E. The next time this macro executes, I'd
like the active cell (target ot the PasteSpecial) to be D3, then D4, etc.

Sub Process4()
Range("A13:A16").Select
Selection.Copy
Sheets("Work Area").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Range("A5").Select
End Sub

"Tim Williams" wrote:

Show your code.

Tim

"Chuck M" wrote in message
...
I am a VBA novice. I've created VBA code by recording Excel macros. I have
a
macro that copies cells from one worksheet and pastes them into another in
the same workbook. I want to run the macro repeatedly and have each
successive row in the target worksheet start one row below the previous
one.
I can pick up the row number from the source worksheet if that would help.
But I don't know how to convert it into a row number in the target
worksheet






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
Iteration Khalil[_2_] Excel Worksheet Functions 4 June 19th 09 08:21 PM
Iteration Alan Beban[_2_] Excel Programming 2 November 3rd 07 07:30 AM
iteration Gareth Milton Excel Discussion (Misc queries) 1 March 28th 07 04:18 PM
Need help with iteration Ron M. Excel Discussion (Misc queries) 7 March 14th 06 12:32 AM
Tracking Virtual Memory (bump) roch1009 Excel Programming 0 January 22nd 04 11:36 PM


All times are GMT +1. The time now is 04:52 AM.

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

About Us

"It's about Microsoft Excel"