Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default macro to copy data and paste to a new sheet in next available cell

Hi everyone

just looking for some guidance here.

i know how to record the macro to copy and paste the data, but i'm
wanting the macro to paste the data into the next available free cell
starting in a different column.

i.e.
range of data to copy- a1:a5
new sheet paste location - h10:L10

any help would be greatly appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default macro to copy data and paste to a new sheet in next available cell

Same sheet or different sheets???

Dim FromRng as range
dim ToCell as range

set fromrng = worksheets("Sheet1").range("a1:a5")
set tocell = worksheets("Sheet2").range("H10") 'could even be the same sheet

fromrng.copy
tocell.pastespecial transpose:=true

===============

Or the next available cell in column H:

Dim FromRng as range
dim ToCell as range

set fromrng = worksheets("Sheet1").range("a1:a5")

with worksheets("Sheet2")
set tocell = .cells(.rows.count,"H").end(xlup).offset(1,0)
end with

fromrng.copy
tocell.pastespecial transpose:=true

===========
And if the ranges were on the same sheet:

with worksheets("Sheet9999")
set fromrng = .range("a1:a5")
set tocell = .cells(.rows.count,"H").end(xlup).offset(1,0)
end with

Neil wrote:

Hi everyone

just looking for some guidance here.

i know how to record the macro to copy and paste the data, but i'm
wanting the macro to paste the data into the next available free cell
starting in a different column.

i.e.
range of data to copy- a1:a5
new sheet paste location - h10:L10

any help would be greatly appreciated.

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default macro to copy data and paste to a new sheet in next availablecell

Thanks Dave. It works perfectly :-)

Cheers
Neil

- Hide quoted text -

- Show quoted text -


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
1 Create a macro to Copy & paste certain data to another sheet Lin1981 Excel Discussion (Misc queries) 1 November 6th 08 11:56 PM
Help to code Macro to Copy fron one sheet and paste in other sheet kay Excel Programming 3 July 25th 08 06:46 PM
macro to copy & paste cell data into another cell dannyboy Excel Programming 2 December 23rd 05 05:01 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
create a macro to copy/paste cell data joshua.v Excel Programming 1 September 14th 04 04:42 PM


All times are GMT +1. The time now is 04:16 PM.

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"