Paste Values into Next Blank Row

BMil8

Board Regular
Joined
Aug 9, 2010
Messages
153
Office Version
  1. 365
Hello, I have the following code which takes the cells in B2:AZ2 and pastes them into the next available row (based on column B). I can't figure out how to only paste values/format and NOT the formulas. Any thoughts?

Dim last_row As Long
last_row = Cells(Rows.Count, "B").End(xlUp).Row
Range("B2:AZ2").Copy Destination:=Cells(last_row + 1, "B")

There were similar questions asked on here before but I can't seem to find the right solution.

Bonus points if it first looks to see if the value of B2 exists in the range below in column B (say B9:B50) and if it does, a pop up asks if I'd like to override that existing line (or delete existing and then add the new one)
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi,
You can adapt the simple rule:
VBA Code:
range("B2").Value=Range("A2").Value
 
Upvote 0
For the first part
VBA Code:
    Dim last_row As Long
    last_row = Cells(Rows.Count, "B").End(xlUp).Row

    Range("B2:AZ2").Copy
    With Cells(last_row + 1, "B")
        .PasteSpecial xlValues
        .PasteSpecial xlFormats
    End With

    Application.CutCopyMode = False
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top