Cut and Paste Loop

lizboal1

New Member
Joined
Jan 26, 2004
Messages
7
Hello, my problem is as follows:

On tab 1 I have a list of questionnaire responses for 8000 customers. So the 20 questions are listed across the columns, and the customers (1-8000) are listed down the rows w/ their responses to each question.

On tab 2 I have the same list of questions and a set of cells where one customer's responses can be filled in. When these cells are filled, a lot of formula logic is performed and on my last tab I get a result of what "segment" the customer falls into. The result is then pasted back onto the fist tab with the associated customer.

I have no problems with my formula logic, and I can create the macro for one customer:

Sub Cut_Paste_Responses()
'
' Cut_Paste_Responses Macro
' Macro recorded 3/15/2004 by elizabeth.l.boal
'
'
Sheets("Questionnaire Response Capture").Select
Range("E4:BJ4").Select
Selection.Copy
Sheets("Questionnaire Response").Select
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Segment").Select
Range("D2").Select
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Questionnaire Response Capture").Select
Range("BP4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Segment").Select
Range("F2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Questionnaire Response Capture").Select
Range("BQ4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End

What I would like to do now is loop back through the formula so it takes the responses from the 2nd customer on tab 1, pastes them into tab 2, retrieves the segment result, and then pastes that result back next to customer 2's responses. Then do this same thing for 3, 4, 5,....8000. I can figure out how to loop the macro, but I don't know how to update the macro to tell it to skip to the next row every time and paste the result in that next row. Basically the macro above has to change for each customer.

I'm sorry if I didn't explain this well. Hope someone can help!

Liz
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
Start with

For x = 2 to 8000

your code here

next x

Now replace all your ranges with x (or 2*x or x+5, whatever) so that the new ranges will be calculated by x.

Post back if you need more help.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top