Activecell Copy/Paste Syntax

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
Guys,

Can I accomplish the following code:

Code:
Range("TotalCost").Copy
Sheets("Programming").Select
ActiveCell.Offset(RowOffset:=0, ColumnOffset:=2).Activate
ActiveCell.Value = Sheets("Operations").Range("TotalCost")
with something like:
Code:
Sheets("Programming").ActiveCell.Offset(0,2) = Sheets("Operations").Range("TotalCost")

Thanks.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,283
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
If I follow you correctly, you'll need
If you are already the active cell in "Programming" you dont to refer to the sheet
Code:
ActiveCell.Offset(0, 2) = Sheets("Operations").Range("TotalCost").Value
 

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
Thanks Michael. I was thinking I would save processing time by not selecting the Programming sheet, but looks like I have to.

Funny how sometimes it doesn't seem to matter if one has 'redundant' code (such as Sheets("Programming")) and sometime it does...
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,283
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
you don't have to Select the programming sheet !
But with Activecell in the syntax, I assumed you were there !
You need only to refer to a range in Sheets "Programming"....eg..
Rich (BB code):
Sheets("Programming").Range("A1").Offset(0,2).value = Sheets("Operations").Range("TotalCost").value
 

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
260
Office Version
  1. 2019
The trouble is the code steps down a column in a Do While IsEmpty(ActiveCell) = False loop; so I guess to use a Range I would have to have a different kind of loop to step through the list. I imagine it would be more complicated programming than my basic ability. The code goes down the list, uses the value to filter another sheet, then copies the SUBTOTAL values to the same row, but 2 columns over.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,415
Messages
5,837,116
Members
430,477
Latest member
roseinsydney

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
Top