If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Macro copies formulas instead of values.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-11, 16:29
JAMiller JAMiller is offline
Registered User
 
Join Date: Sep 2011
Posts: 4
Macro copies formulas instead of values.

I have the following macro and it works but it copies the formula instead of the values.

I need help in editing the macro--I have researched this problem and the solution is PasteSpecial but I do not know how to incorporate into this code??

Here is the macro:

Sub RowCopy()
Dim rngFind As Range

With Worksheets("Summary").UsedRange
Set rngFind = .Find("Totals", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
End With
rngFind.EntireRow.Copy _
Destination:=Worksheets("Sheet3").Range("A1")
End Sub
Reply With Quote
  #2 (permalink)  
Old 09-17-11, 10:14
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Welcome to the forum.

Try this:
Code:
Sub RowCopy()
    
    Dim rngFind As Range
    
    Set rngFind = Worksheets("Summary").UsedRange.Find( _
                            What:="Totals", _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=True)
    
    If Not rngFind Is Nothing Then
        Worksheets("Sheet3").Range("A1").EntireRow.Value = rngFind.EntireRow.Value
    End If
    
End Sub
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 09-17-11, 10:23
JAMiller JAMiller is offline
Registered User
 
Join Date: Sep 2011
Posts: 4
Solved

Hi Colin

That worked great. Thank you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On