Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copy a row using VBA

I would like to perform the following functions:

- copy the formulae in cells C100 to AA100
- paste the formulae above into cells Cxxx to AAxxx where "xxx" represents
the row number associated with the value in Cell C105 (in other words if cell
C105 reflects the value "75", the values would be pasted in cell C75 to AA75
- COPY and PASTE VALUES of cells C [75 - 1] or C&$ to AA74 (i.e. the value
of Cell 105 LESS 1 or in other words, the one row up from the row indicated
by cell 105)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Copy a row using VBA

Hi Eric,

Not sure if I have interpreted this correctly.

You want to copy the formulas from range C100:AA100 and paste the formulas
to a row determined by the value in C105.

You want to copy from the range C100:AA100 and paste values to the row above
the new location?

or did you want to copy from the formulas in the new location and paste
special values to a row above the new location.

The following code has alternative lines for the second copy ready to paste
the values. Comment out or delete the one you do not want. (One is already
commented out)

With Sheets("Sheet1")
.Range("C100:AA100").Copy _
Destination:=.Range("C" & .Range("C105"))

'Following code copies from the original location
'for the paste spoecial values
.Range("C100:AA100").Copy

'Following code copies from the new location of the formulas
'for the paste spoecial values
'.Range("C" & .Range("C105") & ":AA" & .Range("C105")).Copy

'Pastes the values to the row above the first paste.
.Range("C" & .Range("C105") - 1).PasteSpecial _
Paste:=xlPasteValues
End With

Application.CutCopyMode = False



--
Regards,

OssieMac


"Eric_G" wrote:

I would like to perform the following functions:

- copy the formulae in cells C100 to AA100
- paste the formulae above into cells Cxxx to AAxxx where "xxx" represents
the row number associated with the value in Cell C105 (in other words if cell
C105 reflects the value "75", the values would be pasted in cell C75 to AA75
- COPY and PASTE VALUES of cells C [75 - 1] or C&$ to AA74 (i.e. the value
of Cell 105 LESS 1 or in other words, the one row up from the row indicated
by cell 105)

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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
A visual basic value copy BUG?? - accounting format has copy problem!! [email protected] Excel Programming 3 June 20th 06 04:42 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 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
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM


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