Activecell Copy/Paste Syntax

Yamezz

Board Regular
Joined
Nov 22, 2006
Messages
238
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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,130
Office Version
  1. 2016
  2. 2013
  3. 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

Board Regular
Joined
Nov 22, 2006
Messages
238
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
20,130
Office Version
  1. 2016
  2. 2013
  3. 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

Board Regular
Joined
Nov 22, 2006
Messages
238
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,982
Members
416,953
Latest member
broexc

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