Copy and paste only values

J

Jennifer

How do i write in a paste special code for only the values? Thank you my dear
gurus.

Sub Post()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Database")
' find first empty row in database
'iRow = ws.Cells(Rows.Count, 1) .End(xlUp).Offset(1, 0).Row
iRow = ws.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
Worksheets("Filter").Range("FilterDatabase").Copy ws.Cells(iRow, 1)
end sub
 
G

Greg Wilson

Commented out is what you were looking for. I prefer to just specify that the
target range value equals the source range value instead. Also note that I
just add 1 to the result of End(xlUp) instead of using Offset. A tad simpler.


Sub Post()
Dim iRow As Long
Dim ws As Worksheet

Set ws = Worksheets("Database")
iRow = ws.Cells(Rows.Count, 2).End(xlUp).Row + 1
ws.Cells(iRow, 1).Value = _
Worksheets("Filter").Range("FilterDatabase").Value
'Worksheets("Filter").Range("FilterDatabase").Copy
'ws.Cells(iRow, 1).PasteSpecial xlPasteValues
Set ws = Nothing: Set ws2 = Nothing
End Sub

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top