Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default save a range to copy for later

I want to select a range starting with active cell to the last row and copy
it... but first I have to clear the copy range starting in A3... then paste
in A3. can someone help?

first = ActiveCell.Address
col = ActiveCell.Column
lastrow = ActiveSheet.Cells(Rows.Count, col).End(xlUp).Row
lst = "r" & lastrow & "c" & col

Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents


Range(first, lst).Copy
Range("a3").Select
Selection.PasteSpecial Paste:=xlValue
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default save a range to copy for later

And the activecell won't be in column A, right???

dim TopCell as range
dim BotCell as range

with activesheet
if activecell.column = 1 then
msgbox "Not from column A!"
else
set topcell = activecell
set botcell = .cells(.rows.count,topcell.column).end(xlup)

if topcell.row botcell.row then
msgbox "this doesn't look right!"
else
.range("a3:a" & .rows.count).clearcontents
.range(topcell, botcell).copy
.range("A3").pastespecial paste:=xlpastevalues
end if
end if
end with


John wrote:

I want to select a range starting with active cell to the last row and copy
it... but first I have to clear the copy range starting in A3... then paste
in A3. can someone help?

first = ActiveCell.Address
col = ActiveCell.Column
lastrow = ActiveSheet.Cells(Rows.Count, col).End(xlUp).Row
lst = "r" & lastrow & "c" & col

Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents


Range(first, lst).Copy
Range("a3").Select
Selection.PasteSpecial Paste:=xlValue


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default save a range to copy for later

Nevermind...
lastcell = ActiveSheet.Cells(Rows.Count, col).End(xlUp).Address

rather than .row

"John" wrote:

I want to select a range starting with active cell to the last row and copy
it... but first I have to clear the copy range starting in A3... then paste
in A3. can someone help?

first = ActiveCell.Address
col = ActiveCell.Column
lastrow = ActiveSheet.Cells(Rows.Count, col).End(xlUp).Row
lst = "r" & lastrow & "c" & col

Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents


Range(first, lst).Copy
Range("a3").Select
Selection.PasteSpecial Paste:=xlValue

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
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
Subscript out of range error - save copy error bg18461[_15_] Excel Programming 1 June 13th 06 04:36 PM
Save column J only using copy/paste & temporary copy mikeburg[_85_] Excel Programming 2 June 7th 06 05:37 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
How to save a file without overwrite or save a copy? SettingChange Setting up and Configuration of Excel 1 November 3rd 05 02:10 AM


All times are GMT +1. The time now is 04:27 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"