How to select last visible cell in column and then copy paste it to another sheet ?

Tullzter

New Member
Joined
Aug 27, 2019
Messages
3
Hello all,

this is my first post as i've recently begun to dabble in VBA..and to be fair i'm quite amazed at how useful it is.

I need your help today with a code i'm writing that would allow me to copy the last visible cell from a given column (B) onto a new sheet, here is my code so far but i'm getting an issue clearing the copy part

Worksheets("Summary").Activate
Range("B" & Cells.Rows.Count).End(xlUp).Select.Copy
Worksheets(2).Activate
Range("d1").Paste

thank you for your help, i appreciate it
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Welcome to the MrExcel board!

As you 'dabble' more in vba you will find that is is seldom necessary to Activate or Select things to work with them. Further, those two actions slow the code which can be important if the code is doing a lot.

Try this (no Activate or Select)
Code:
Worksheets("Summary").Range("B" & Cells.Rows.Count).End(xlUp).Copy Worksheets(2).Range("d1")
 
Last edited:
Upvote 0
Thank you sir, it worked like a charm but say i want to copy paste formats and values, how would i go about doing it ?
 
Upvote 0
Thank you sir, it worked like a charm but say i want to copy paste formats and values, how would i go about doing it ?
A few more steps, but still no activate/select.
Code:
Worksheets("Summary").Range("B" & Cells.Rows.Count).End(xlUp).Copy
With Worksheets(2).Range("D1")
  .PasteSpecial Paste:=xlPasteValuesAndNumberFormats
  .PasteSpecial Paste:=xlPasteFormats
End With
Application.CutCopyMode = False
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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