VBA Copy paste from Sheet to Sheet

CathalP1992

New Member
Joined
Nov 30, 2022
Messages
9
Office Version
  1. 2021
Platform
  1. Windows
Hi Everyone,
I have a task at the moment whereby I am trying to "Copy" a single cell containing real time data from "Sheet A" and paste that cell value at that specific moment in time into "Sheet B" on the next available row on in the designated column.



So that over time I will have a database of values of that parameter at that time and can manipulate how I require.

The VBA I have so far is this



Range("B2").Select
Sheets("MainSheet").Select
Range("D9").Select
Selection.Copy
Sheets("DatabaseSheet").Select
ActiveCell.Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste



The area I am having trouble is the final line.



ActiveSheet.Paste



pastes the copied cell and formula. All I want is the cell value at that time.

I have tried



ActiveSheet.PasteSpecial Paste:=xlPasteValues



but get an error.

Can anyone suggest a solution?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,

how about

VBA Code:
Sheets("DatabaseSheet").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Value = Sheets("MainSheet").Range("D9").Value


Ciao,
Holger
 
Upvote 0
Just in case you wanted to know what went wrong with your paste special, although Activesheet works for a straight paste and defaults to the Activecell, the paste special needs the actual range. So swap ActiveSheet for ActiveCell.

Rich (BB code):
ActiveCell.PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Just in case you wanted to know what went wrong with your paste special, although Activesheet works for a straight paste and defaults to the Activecell, the paste special needs the actual range. So swap ActiveSheet for ActiveCell.

Rich (BB code):
ActiveCell.PasteSpecial Paste:=xlPasteValues
Cool thanks.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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