Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro moving down the sheet cell by cell

I have successfully created a macro that copies and pastes data fro
three columns of a row into a single entry in a single cell in tha
same row. I am trying to get this macro to perform the same functio
in multiple cells directly beneath the row where I recorded it. Fo
example, I have it working in row 3. I want it to perform the sam
function in rows 4 through 200.

How do I get it to move down one row, execute, move down one row
execute, move down one row, execute etc and stay row relative...?

When I run the macro now, it always returns to row 3 and executes.

I am not a programmer and have very limited experience with macros (a
you can probably tell).

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Macro moving down the sheet cell by cell

You will need to post your code because you must change some of the recorded
code to change the copy reference.

The secret will be to create a parent subrouting that moved to each new
selection, then
executes your copy-paste subroutine.

How do you want to tell it the range of cells to operate on? With a named
range.
Have the user highlight some cells and cycle through the cells?

You have a block of cells you select to start and it will loop until it
finds a row with a blank cell in the first column.

Sub CycleCells()
Dim rngTarget As Range
Set rngTarget = Selection

Set rngTarget = rngTarget.Resize(1, 3) 'change the selection to 1 row
by 3 cells.

Do Until (rngTarget.Cells(1, 1) = "" Or IsEmpty(rngTarget.Cells(1, 1)))
rngTarget.Select 'optional, only if you want to see it
change the selection
'MyCopyPaste rngTarget
'move the selection down one row
Set rngTarget = rngTarget.Offset(1, 0)
DoEvents '(always put this in a loop to make the computer list to
the keyboard and mouse)
Loop

End Sub

Stephen Rasey
Houston
http://wiserways.com
http://excelsig.org




"berlead " wrote in message
...
I have successfully created a macro that copies and pastes data from
three columns of a row into a single entry in a single cell in that
same row. I am trying to get this macro to perform the same function
in multiple cells directly beneath the row where I recorded it. For
example, I have it working in row 3. I want it to perform the same
function in rows 4 through 200.

How do I get it to move down one row, execute, move down one row,
execute, move down one row, execute etc and stay row relative...?

When I run the macro now, it always returns to row 3 and executes.

I am not a programmer and have very limited experience with macros (as
you can probably tell).

Thanks!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro moving down the sheet cell by cell

Thanks for your reply. I have to create an email distribution list fo
a number of users in my division, and I am starting with a list o
first names, last names and then I know the our domain ) S
what I did is below: (I x'ed out parts of the names and domain fo
privacy reasons.)


Sub name()
'
' name Macro
' Macro recorded 8/26/2004 by rice-b
'

'
Range("K4").Select
ActiveCell.FormulaR1C1 = "AnXXXXX"
Range("N4").Select
ActiveSheet.Paste
ActiveCell.FormulaR1C1 = "AnXXXXX."
Range("L4").Select
ActiveCell.FormulaR1C1 = "DeXXXX"
Range("N4").Select
ActiveCell.FormulaR1C1 = "AnXXXXX.DeXXXX@"
Range("M4").Select
ActiveCell.FormulaR1C1 = "XXX.com"
Range("N4").Select
ActiveCell.FormulaR1C1 = "
Range("N5").Select
End Su

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Macro moving down the sheet cell by cell

You do not need a macro to do this.

Columns K, L, and M are three parts to an internet mail address.
give the N5 cell the formula
=K5 & "." & L5 & "@" & M5
Copy it down.

Stephen Rasey
Houston

"berlead " wrote in message
...
Thanks for your reply. I have to create an email distribution list for
a number of users in my division, and I am starting with a list of
first names, last names and then I know the our domain ) So
what I did is below: (I x'ed out parts of the names and domain for
privacy reasons.)


Sub name()
'
' name Macro
' Macro recorded 8/26/2004 by rice-b
'

'
Range("K4").Select
ActiveCell.FormulaR1C1 = "AnXXXXX"
Range("N4").Select
ActiveSheet.Paste
ActiveCell.FormulaR1C1 = "AnXXXXX."
Range("L4").Select
ActiveCell.FormulaR1C1 = "DeXXXX"
Range("N4").Select
ActiveCell.FormulaR1C1 = "AnXXXXX.DeXXXX@"
Range("M4").Select
ActiveCell.FormulaR1C1 = "XXX.com"
Range("N4").Select
ActiveCell.FormulaR1C1 = "
Range("N5").Select
End Sub


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro moving down the sheet cell by cell

That worked! Thanks for your reply! :-

--
Message posted from http://www.ExcelForum.com

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
how to skipp an already filled cell when moving across excel sheet Alexmcghad Excel Discussion (Misc queries) 4 January 11th 09 09:24 PM
Sheet slow moving from cell to cell JeffLV Excel Discussion (Misc queries) 2 August 25th 08 05:14 AM
Moving rows from one sheet to another based on a particular cell v mm Excel Discussion (Misc queries) 0 November 11th 05 06:29 PM
Moving Down a Cell in Macro Anonymous Excel Discussion (Misc queries) 2 December 5th 04 09:50 AM
Moving 1 Data Cell into A second Sheet? iomighty Excel Programming 1 June 2nd 04 12:13 AM


All times are GMT +1. The time now is 07:10 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"