Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Paste Special

I am trying to write in my macro to put a specific formula in cell C2 then
copy it to all cells in that column that are active rows. The active rows
will change each time, so I may have 50 then 25. I then need to copy that
column and do a paste special values to get rid of the formula and just have
the value. Here is the code, but it is not working. Please help!

Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]0,400,500)"
Selection.Copy
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
ActiveSheet.PasteSpecial Paste:=xlPasteValues
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Paste Special

LastRow = Cells(Rows.Count, "c").End(xlUp).Row
Range("C2").Resize(LastRow - 1).FormulaR1C1 = "=IF(RC[2]0,400,500)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jasmine" wrote in message
...
I am trying to write in my macro to put a specific formula in cell C2 then
copy it to all cells in that column that are active rows. The active rows
will change each time, so I may have 50 then 25. I then need to copy that
column and do a paste special values to get rid of the formula and just

have
the value. Here is the code, but it is not working. Please help!

Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]0,400,500)"
Selection.Copy
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
ActiveSheet.PasteSpecial Paste:=xlPasteValues



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Paste Special

I am getting a Run-time error 1004.

"Bob Phillips" wrote:

LastRow = Cells(Rows.Count, "c").End(xlUp).Row
Range("C2").Resize(LastRow - 1).FormulaR1C1 = "=IF(RC[2]0,400,500)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jasmine" wrote in message
...
I am trying to write in my macro to put a specific formula in cell C2 then
copy it to all cells in that column that are active rows. The active rows
will change each time, so I may have 50 then 25. I then need to copy that
column and do a paste special values to get rid of the formula and just

have
the value. Here is the code, but it is not working. Please help!

Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]0,400,500)"
Selection.Copy
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
ActiveSheet.PasteSpecial Paste:=xlPasteValues




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Paste Special

Do you have anything in column C?

If not, then LastRow will be 1 and lastrow -1 will be 0.

Can you use a different column than C to get the lastrow...

Maybe B:

LastRow = Cells(Rows.Count, "B").End(xlUp).Row




Jasmine wrote:

I am getting a Run-time error 1004.

"Bob Phillips" wrote:

LastRow = Cells(Rows.Count, "c").End(xlUp).Row
Range("C2").Resize(LastRow - 1).FormulaR1C1 = "=IF(RC[2]0,400,500)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jasmine" wrote in message
...
I am trying to write in my macro to put a specific formula in cell C2 then
copy it to all cells in that column that are active rows. The active rows
will change each time, so I may have 50 then 25. I then need to copy that
column and do a paste special values to get rid of the formula and just

have
the value. Here is the code, but it is not working. Please help!

Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]0,400,500)"
Selection.Copy
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
ActiveSheet.PasteSpecial Paste:=xlPasteValues





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Paste Special

That worked! Thanks!

"Dave Peterson" wrote:

Do you have anything in column C?

If not, then LastRow will be 1 and lastrow -1 will be 0.

Can you use a different column than C to get the lastrow...

Maybe B:

LastRow = Cells(Rows.Count, "B").End(xlUp).Row




Jasmine wrote:

I am getting a Run-time error 1004.

"Bob Phillips" wrote:

LastRow = Cells(Rows.Count, "c").End(xlUp).Row
Range("C2").Resize(LastRow - 1).FormulaR1C1 = "=IF(RC[2]0,400,500)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jasmine" wrote in message
...
I am trying to write in my macro to put a specific formula in cell C2 then
copy it to all cells in that column that are active rows. The active rows
will change each time, so I may have 50 then 25. I then need to copy that
column and do a paste special values to get rid of the formula and just
have
the value. Here is the code, but it is not working. Please help!

Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]0,400,500)"
Selection.Copy
lastrow = Cells(Rows.Count, "c").End(xlUp).Row
ActiveSheet.PasteSpecial Paste:=xlPasteValues




--

Dave Peterson



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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
How do I capture user paste action and convert to Paste Special DonC Excel Programming 0 November 19th 04 01:43 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 02:12 AM.

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

About Us

"It's about Microsoft Excel"