PC Review


Reply
Thread Tools Rate Thread

Copy a row using VBA

 
 
Eric_G
Guest
Posts: n/a
 
      27th Mar 2009
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 With Quote
 
 
 
 
OssieMac
Guest
Posts: n/a
 
      27th Mar 2009
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
http://LongPathTool.com - find and delete/copy path too long filesfrom your hard drive or LAN Windows tool to copy or delete files and folderswith path too long or filename too long error. Just browse to the file andpress a button to copy or d Martin Krag Windows XP Internet Explorer 0 22nd Apr 2011 10:08 AM
http://LongPathTool.com - find and delete/copy path too long filesfrom your hard drive or LAN Windows tool to copy or delete files and folderswith path too long or filename too long error. Just browse to the file andpress a button to copy or d Martin Krag Windows XP Configuration 0 22nd Apr 2011 10:05 AM
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Microsoft Windows 2000 Active Directory 1 17th Feb 2009 01:31 PM
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Windows Vista General Discussion 2 17th Feb 2009 01:31 PM
EXCEL FILE a copy/a copy/a copy ....filename =?Utf-8?B?dmU=?= Microsoft Excel New Users 1 29th Sep 2005 09:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:23 AM.