View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J.W. Aldridge J.W. Aldridge is offline
external usenet poster
 
Posts: 425
Default 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