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

The peice of code below works fine. However, I need the formulas after
calculating the answer to become paste special values. Example: "
=24+56" is a formula answer of 80 ...Which is what I currently get.
What I want in the cell is 80.

Is there a easy way to do this in the below code?

Many thanks...

Sub semiannual()
Dim v As Variant
Dim v1 As Variant
Dim rng As Range
Dim cell As Range
Dim res As Variant

v1 = Array("S")

Set rng = Range(Cells(3, 4), Cells(3, 4).End(xlDown))

For Each cell In rng
res = Application.Match(cell.Value, v1, 0)
If Not IsError(res) Then

cell.Offset(0, 3).Resize(1, 1).Value = "=RC[-5]+56 "

'Should paste special values here.


cell.Offset(0, 6).Resize(1, 1).Value = "=RC[-1]+76)"


'Should paste special values here.


End If
Next


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Paste Special Values VBA

With cell.Offset(0, 3).Resize(1, 1)
.FormulaR1C1 = "=RC[-5]+56 "
.Formula = .Value
End with
'Should paste special values here.


With cell.Offset(0, 6).Resize(1, 1)
.FormulaR1C1 = "=RC[-1]+76"
.Formula = .Value
End With

--
Regards,
Tom Ogilvy


wrote in message
ups.com...
The peice of code below works fine. However, I need the formulas after
calculating the answer to become paste special values. Example: "
=24+56" is a formula answer of 80 ...Which is what I currently get.
What I want in the cell is 80.

Is there a easy way to do this in the below code?

Many thanks...

Sub semiannual()
Dim v As Variant
Dim v1 As Variant
Dim rng As Range
Dim cell As Range
Dim res As Variant

v1 = Array("S")

Set rng = Range(Cells(3, 4), Cells(3, 4).End(xlDown))

For Each cell In rng
res = Application.Match(cell.Value, v1, 0)
If Not IsError(res) Then

cell.Offset(0, 3).Resize(1, 1).Value = "=RC[-5]+56 "

'Should paste special values here.


cell.Offset(0, 6).Resize(1, 1).Value = "=RC[-1]+76)"


'Should paste special values here.


End If
Next


End Sub



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

I'll take full responsibility for the FormulaR1c1 debacle!

But only partial for the parenthesis--I copied and pasted. (I didn't notice, so
I didn't correct.)

But other than that, it was a fine post!

<vbg



Tom Ogilvy wrote:

"Oopsie"!!

.formluar1c1 = "=RC[-1]+76)"


probably want to change the spelling of "formlua" to "formula" and drop the
extra paren on the end of the function.

.formular1c1 = "=RC[-1]+76"

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
With cell.Offset(0, 6).Resize(1, 1)
.formluar1c1 = "=RC[-1]+76)"
.value = .value
end with

(similar in both spots)

wrote:

The peice of code below works fine. However, I need the formulas after
calculating the answer to become paste special values. Example: "
=24+56" is a formula answer of 80 ...Which is what I currently get.
What I want in the cell is 80.

Is there a easy way to do this in the below code?

Many thanks...

Sub semiannual()
Dim v As Variant
Dim v1 As Variant
Dim rng As Range
Dim cell As Range
Dim res As Variant

v1 = Array("S")

Set rng = Range(Cells(3, 4), Cells(3, 4).End(xlDown))

For Each cell In rng
res = Application.Match(cell.Value, v1, 0)
If Not IsError(res) Then

cell.Offset(0, 3).Resize(1, 1).Value = "=RC[-5]+56 "

'Should paste special values here.

cell.Offset(0, 6).Resize(1, 1).Value = "=RC[-1]+76)"

'Should paste special values here.

End If
Next

End Sub


--

Dave Peterson


--

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
Paste Special - Values KYMO Excel Worksheet Functions 1 June 8th 06 05:17 PM
paste special values baiju101 Excel Worksheet Functions 1 April 4th 06 02:11 PM
Paste Special Values [email protected] Excel Programming 2 July 6th 05 02:51 AM
paste special values jenn Excel Worksheet Functions 2 February 3rd 05 01:45 AM
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 04:58 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"