Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add data to sheet, in next available column.
Hello.
I am trying to alter the following code to get what I want. What I want is: 1) Copy all values/data from sheet "errors" and paste on "data_sum" 2)Copy all data from sheet "corrects" and paste on "data_sum" on the next available row (where the data from sheet "errors" ended, and column A is empty). Sub CopyData() Dim va s Variant, i as Long, sh as worksheet Dim rng as Range, rng1 as Range dim sh1 as Worksheet v = Array("Monday","Tuesday","Wednesday","Thursday","F riday","Saturday") for i = lbound(v) to ubound(v) set sh = worksheets(v(i)) Next set sh1 = Worksheets("shorter") sh1.Cells.Clearcontents for i = lbound(v) to ubound(v) set sh = worksheets(v(i)) set rng = sh.Range("A1").currentRegion set rng1 = sh1.Cells(rows.count,1).End(xlup) if not isempty(rng1) then set rng1 = rng1(2) rng.copy rng1.Pastespecial xlValues next |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add data to sheet, in next available column.
Sub CopyData()
Dim Lrow As Long Worksheets("errors").UsedRange.Copy Worksheets("data_sum").Range("A1") Lrow = Worksheets("data_sum").Cells(Rows.Count, 1).End(xlUp).Row + 1 Worksheets("corrects").UsedRange.Copy Worksheets("data_sum").Range("A" & Lrow) End Sub Mike F "J.W. Aldridge" wrote in message ups.com... Hello. I am trying to alter the following code to get what I want. What I want is: 1) Copy all values/data from sheet "errors" and paste on "data_sum" 2)Copy all data from sheet "corrects" and paste on "data_sum" on the next available row (where the data from sheet "errors" ended, and column A is empty). Sub CopyData() Dim va s Variant, i as Long, sh as worksheet Dim rng as Range, rng1 as Range dim sh1 as Worksheet v = Array("Monday","Tuesday","Wednesday","Thursday","F riday","Saturday") for i = lbound(v) to ubound(v) set sh = worksheets(v(i)) Next set sh1 = Worksheets("shorter") sh1.Cells.Clearcontents for i = lbound(v) to ubound(v) set sh = worksheets(v(i)) set rng = sh.Range("A1").currentRegion set rng1 = sh1.Cells(rows.count,1).End(xlup) if not isempty(rng1) then set rng1 = rng1(2) rng.copy rng1.Pastespecial xlValues next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referencing entire column of data from another sheet. | Excel Worksheet Functions | |||
Pulling an column/row Data from one sheet- another if critria is m | Excel Discussion (Misc queries) | |||
Column Data to Appear as Column Headings in Another Sheet | Excel Discussion (Misc queries) | |||
2 column List Box populated with data not from Excel sheet? | Excel Programming | |||
VB copy paste column data to another left to right sheet across sh | Excel Programming |