ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   [newbie] Macro for "copy and paste" (https://www.excelbanter.com/excel-discussion-misc-queries/226410-%5Bnewbie%5D-macro-copy-paste.html)

Jon

[newbie] Macro for "copy and paste"
 
I have an excel sheet which needs to copy values iteratively.

So for example, on sheet 2 I want to

1. copy value of sheet 1 cell A1 to sheet 2 cell A1
2. print it or send it to a print queue
3. clear the values from sheet 2 cell A1
4. copy value of sheet 1 cell A2 to sheet 2 cell A1 (replace contents)

The above process would be repeated for a number of values that is displayed
within sheet 1 cell A1.

Any ideas how to go about it?


Jacob Skaria

[newbie] Macro for "copy and paste"
 
Dear Jon..........try this

Sub PrintSheet2()

Dim lngRow
Dim wrbMyBook

Set wrbMyBook = ActiveWorkbook
lngRow = 1

Do While wrbMyBook.Sheets("Sheet1").Range("A" & lngRow) < ""
wrbMyBook.Sheets("Sheet2").Range("A1") =
wrbMyBook.Sheets("Sheet1").Range("A" & lngRow)
wrbMyBook.Sheets("Sheet2").PrintOut Copies:=1, Collate:=True
lngRow = lngRow + 1
Loop

End Sub

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


"Jon" wrote:

I have an excel sheet which needs to copy values iteratively.

So for example, on sheet 2 I want to

1. copy value of sheet 1 cell A1 to sheet 2 cell A1
2. print it or send it to a print queue
3. clear the values from sheet 2 cell A1
4. copy value of sheet 1 cell A2 to sheet 2 cell A1 (replace contents)

The above process would be repeated for a number of values that is displayed
within sheet 1 cell A1.

Any ideas how to go about it?



All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com