Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Automating skipping rows between selected cells. Please Help

Fellow Forum Members,
I would appreciate it a lot if someone can help me develop a macro that will
let me selectively copy cells and allow me to control the quantity of rows I
need skipped between each copied cell.

Currently I press the CONTROL button and manually select 50 cells in "Column
A" and manually skip 3 rows between each cell I select to copy. The result is
50 cells selected with three rows in between each selected cell.

This is tedious work and I need a macro that would ask me three questions
before I run it:

Question One: What is the first cell you want to copy?

My answer is : "A1"

Question Two: Total number of cells you want to copy following Cell "A1"?

My answer is : X (Could be 25, 30, 40 could be any number)

Question Three: How many rows do you want to skip between each of the copied
cells starting with cell "A1" ?

My answer is : X (could be 3, 4, 5, 6, 7, could be any number)

IS such a macro possible? I need to set this up because I am spending too
much time doing this custom type of copying over and over again. I need to
tell Excel how many rows to skip between each copied cell. If any one can
help me out in developing such a Macro I would be very grateful. Thank you
very much.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default Automating skipping rows between selected cells. Please Help

Here it is
'for start enter the row number i.e. 1 and not A1
'if rows to skip is 2 then it will copy row 1,4,7,...
'source sheet1, destination sheet2
Sub copyRows()
Dim startRow, noOfRows, totalRows As Long
startRow = InputBox("Enter the row to start")
noOfRows = InputBox("Enter the no of rows to skip") + 1
totalRows = InputBox("Enter toral no of rows to copy")
Application.ScreenUpdating = False
For i = 1 To totalRows
Worksheets("Sheet1").Select
Worksheets("Sheet1").Cells(startRow + (i - 1) * noOfRows, 1).EntireRow.Copy
Worksheets("Sheet2").Select
Worksheets("Sheet2").Cells(i, 1).PasteSpecial
Next
Application.ScreenUpdating = True
End Sub

"binar" wrote:

Fellow Forum Members,
I would appreciate it a lot if someone can help me develop a macro that will
let me selectively copy cells and allow me to control the quantity of rows I
need skipped between each copied cell.

Currently I press the CONTROL button and manually select 50 cells in "Column
A" and manually skip 3 rows between each cell I select to copy. The result is
50 cells selected with three rows in between each selected cell.

This is tedious work and I need a macro that would ask me three questions
before I run it:

Question One: What is the first cell you want to copy?

My answer is : "A1"

Question Two: Total number of cells you want to copy following Cell "A1"?

My answer is : X (Could be 25, 30, 40 could be any number)

Question Three: How many rows do you want to skip between each of the copied
cells starting with cell "A1" ?

My answer is : X (could be 3, 4, 5, 6, 7, could be any number)

IS such a macro possible? I need to set this up because I am spending too
much time doing this custom type of copying over and over again. I need to
tell Excel how many rows to skip between each copied cell. If any one can
help me out in developing such a Macro I would be very grateful. Thank you
very much.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Automating skipping rows between selected cells. Please Help

Sheeloo,
Thanks a lot for this script. You are a genuis! This little script of yours
works exactly as I envisioned it. It is awesome. I was going to buy the app
in the link below and play around with it to see if it could do what I wanted
to do in Excel.

http://www.tethyssolutions.com/product.htm


But since your app is perfect I think I am no longer going to buy it.
Again, thanks a lot. You are a talented VBA programmer.

P.S. In your last popup window the word "total" is misspelled. However, it
was easy enough for me to fix.


"Sheeloo" wrote:

Here it is
'for start enter the row number i.e. 1 and not A1
'if rows to skip is 2 then it will copy row 1,4,7,...
'source sheet1, destination sheet2
Sub copyRows()
Dim startRow, noOfRows, totalRows As Long
startRow = InputBox("Enter the row to start")
noOfRows = InputBox("Enter the no of rows to skip") + 1
totalRows = InputBox("Enter toral no of rows to copy")
Application.ScreenUpdating = False
For i = 1 To totalRows
Worksheets("Sheet1").Select
Worksheets("Sheet1").Cells(startRow + (i - 1) * noOfRows, 1).EntireRow.Copy
Worksheets("Sheet2").Select
Worksheets("Sheet2").Cells(i, 1).PasteSpecial
Next
Application.ScreenUpdating = True
End Sub

"binar" wrote:

Fellow Forum Members,
I would appreciate it a lot if someone can help me develop a macro that will
let me selectively copy cells and allow me to control the quantity of rows I
need skipped between each copied cell.

Currently I press the CONTROL button and manually select 50 cells in "Column
A" and manually skip 3 rows between each cell I select to copy. The result is
50 cells selected with three rows in between each selected cell.

This is tedious work and I need a macro that would ask me three questions
before I run it:

Question One: What is the first cell you want to copy?

My answer is : "A1"

Question Two: Total number of cells you want to copy following Cell "A1"?

My answer is : X (Could be 25, 30, 40 could be any number)

Question Three: How many rows do you want to skip between each of the copied
cells starting with cell "A1" ?

My answer is : X (could be 3, 4, 5, 6, 7, could be any number)

IS such a macro possible? I need to set this up because I am spending too
much time doing this custom type of copying over and over again. I need to
tell Excel how many rows to skip between each copied cell. If any one can
help me out in developing such a Macro I would be very grateful. Thank you
very much.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Automating skipping rows between selected cells. Please Help

Sheeloo,
Thanks a lot for this script. You are a genuis! This little script of yours
works exactly as I envisioned it. It is awesome. I was going to buy the app
in the link below and play around with it to see if it could do what I wanted
to do in Excel.

http://www.tethyssolutions.com/product.htm


But since your app is perfect I think I am no longer going to buy it.
Again, thanks a lot. You are a talented VBA programmer.

P.S. In your last popup window the word "total" is misspelled. However, it
was easy enough for me to fix.


"Sheeloo" wrote:

Here it is
'for start enter the row number i.e. 1 and not A1
'if rows to skip is 2 then it will copy row 1,4,7,...
'source sheet1, destination sheet2
Sub copyRows()
Dim startRow, noOfRows, totalRows As Long
startRow = InputBox("Enter the row to start")
noOfRows = InputBox("Enter the no of rows to skip") + 1
totalRows = InputBox("Enter toral no of rows to copy")
Application.ScreenUpdating = False
For i = 1 To totalRows
Worksheets("Sheet1").Select
Worksheets("Sheet1").Cells(startRow + (i - 1) * noOfRows, 1).EntireRow.Copy
Worksheets("Sheet2").Select
Worksheets("Sheet2").Cells(i, 1).PasteSpecial
Next
Application.ScreenUpdating = True
End Sub

"binar" wrote:

Fellow Forum Members,
I would appreciate it a lot if someone can help me develop a macro that will
let me selectively copy cells and allow me to control the quantity of rows I
need skipped between each copied cell.

Currently I press the CONTROL button and manually select 50 cells in "Column
A" and manually skip 3 rows between each cell I select to copy. The result is
50 cells selected with three rows in between each selected cell.

This is tedious work and I need a macro that would ask me three questions
before I run it:

Question One: What is the first cell you want to copy?

My answer is : "A1"

Question Two: Total number of cells you want to copy following Cell "A1"?

My answer is : X (Could be 25, 30, 40 could be any number)

Question Three: How many rows do you want to skip between each of the copied
cells starting with cell "A1" ?

My answer is : X (could be 3, 4, 5, 6, 7, could be any number)

IS such a macro possible? I need to set this up because I am spending too
much time doing this custom type of copying over and over again. I need to
tell Excel how many rows to skip between each copied cell. If any one can
help me out in developing such a Macro I would be very grateful. Thank you
very much.

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
Multiple Cells/rows in Column selected when a single cell is click Mick Excel Discussion (Misc queries) 0 October 10th 08 02:05 PM
Highlighting selected cells/rows/columns [email protected] New Users to Excel 0 May 21st 08 09:13 PM
Skipping rows with VBA Jeff Excel Discussion (Misc queries) 4 April 24th 06 06:48 PM
I want to sort selected cells in Excel, not entire rows. Aeryn635 Excel Discussion (Misc queries) 1 June 1st 05 07:58 PM
delete columns and rows-cells equalling zero or any selected value Scottie Excel Worksheet Functions 2 May 9th 05 08:47 PM


All times are GMT +1. The time now is 07:13 PM.

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"