Add data to sheet, in next available column.

J

J.W. Aldridge

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","Friday","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
 
M

Mike Fogleman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top