PC Review


Reply
Thread Tools Rate Thread

Copy and Paste Loop

 
 
AK
Guest
Posts: n/a
 
      26th Nov 2009
Need help with how to write a loop function...

* Data in a list is in column A on Sheet1 - the number of entries in the
list may vary

* Starting from A1 on Sheet1 I need to copy the value and paste special the
value to Sheet 2 cell B1 - there are calculations that run based on the value
in B1

* I then copy a range from Sheet 2 and paste special to Sheet 3 - this part
I know how to write code for

* After the copy / paste of the range from Sheet 2 to Sheet 3, I need to go
back to Sheet 1 and select the next item in the list in column A - this would
be A2 in this example

* Then run through the copy/paste from Sheet 1 to Sheet 2 - run the
calculations - then copy/paste range from Sheet 2 to Sheet 3

* Repeat until the last record in the list in Column A on Sheet 1

THANK YOU IN ADVANCE!!!!
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      26th Nov 2009
Try the below...

Sub MyMacro()
Dim ws1 As Worksheet, ws2 As Worksheet, ws2 As Worksheet
Dim lngRow As Long

Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
Set ws3 = Sheets("Sheet3")

'Loop until last record of sheet1 ColA
For lngRow = 1 To ws1.Cells(Rows.Count, "A").End(xlUp).Row
'Copy each row of Sheet1 Col A to Sheet2 B1
ws1.Range("A" & lngRow).Copy ws2.Range("B1")
'Some calulations

'Copy from Sheet2 to Sheet3
'ws2.Range("A" & lngRow).Copy ws3.Range("B1")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"AK" wrote:

> Need help with how to write a loop function...
>
> * Data in a list is in column A on Sheet1 - the number of entries in the
> list may vary
>
> * Starting from A1 on Sheet1 I need to copy the value and paste special the
> value to Sheet 2 cell B1 - there are calculations that run based on the value
> in B1
>
> * I then copy a range from Sheet 2 and paste special to Sheet 3 - this part
> I know how to write code for
>
> * After the copy / paste of the range from Sheet 2 to Sheet 3, I need to go
> back to Sheet 1 and select the next item in the list in column A - this would
> be A2 in this example
>
> * Then run through the copy/paste from Sheet 1 to Sheet 2 - run the
> calculations - then copy/paste range from Sheet 2 to Sheet 3
>
> * Repeat until the last record in the list in Column A on Sheet 1
>
> THANK YOU IN ADVANCE!!!!

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      26th Nov 2009
dim cell as range
set cell = worksheets("sheet1").Range("A1")
DO UNTIL Cell.Value = ""
Worksheets("Sheet2").Cells(cell.Row,"B").Value = cell.Value
set cell = cell.Offset(1)
LOOP

"AK" <(E-Mail Removed)> wrote in message
news:FB701D89-4122-43A8-9A1F-(E-Mail Removed)...
> Need help with how to write a loop function...
>
> * Data in a list is in column A on Sheet1 - the number of entries in the
> list may vary
>
> * Starting from A1 on Sheet1 I need to copy the value and paste special
> the
> value to Sheet 2 cell B1 - there are calculations that run based on the
> value
> in B1
>
> * I then copy a range from Sheet 2 and paste special to Sheet 3 - this
> part
> I know how to write code for
>
> * After the copy / paste of the range from Sheet 2 to Sheet 3, I need to
> go
> back to Sheet 1 and select the next item in the list in column A - this
> would
> be A2 in this example
>
> * Then run through the copy/paste from Sheet 1 to Sheet 2 - run the
> calculations - then copy/paste range from Sheet 2 to Sheet 3
>
> * Repeat until the last record in the list in Column A on Sheet 1
>
> THANK YOU IN ADVANCE!!!!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy paste loop---new to vba =?Utf-8?B?TUZS?= Microsoft Excel Programming 4 26th Oct 2006 08:25 PM
Copy and Paste using a loop bestie via OfficeKB.com Microsoft Excel Programming 0 3rd Aug 2006 08:57 AM
Copy and Paste Loop japorms Microsoft Excel Programming 2 19th Jul 2006 09:07 PM
Copy/Paste Loop =?Utf-8?B?SmVsbHknJ3M=?= Microsoft Excel Programming 2 7th Dec 2005 12:03 AM
Copy/Paste loop PRINCE21 Microsoft Excel Misc 3 5th Feb 2004 12:27 AM


Features
 

Advertising
 

Newsgroups
 


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