Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AK AK is offline
external usenet poster
 
Posts: 56
Default Copy and Paste Loop

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!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Copy and Paste Loop

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!!!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Copy and Paste Loop

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" wrote in message
...
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
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
copy paste loop---new to vba MFR Excel Programming 4 October 26th 06 08:25 PM
Copy and Paste using a loop bestie via OfficeKB.com Excel Programming 0 August 3rd 06 08:57 AM
Copy and Paste Loop japorms[_17_] Excel Programming 2 July 19th 06 09:07 PM
Copy/Paste Loop Jelly''s Excel Programming 0 December 6th 05 10:10 PM
copy and paste loop Dillonstar[_5_] Excel Programming 1 December 11th 03 04:22 PM


All times are GMT +1. The time now is 10:23 AM.

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"