Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default 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
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
Referencing entire column of data from another sheet. gtslabs Excel Worksheet Functions 1 February 1st 09 07:25 PM
Pulling an column/row Data from one sheet- another if critria is m Farmer Ted Excel Discussion (Misc queries) 1 January 30th 09 11:09 PM
Column Data to Appear as Column Headings in Another Sheet Monk[_2_] Excel Discussion (Misc queries) 3 November 27th 08 09:47 PM
2 column List Box populated with data not from Excel sheet? MariahJ Excel Programming 1 December 11th 06 06:44 PM
VB copy paste column data to another left to right sheet across sh baz Excel Programming 2 April 23rd 06 09:37 AM


All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"