Activecell Copy/Paste Syntax

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
334
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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
 
Upvote 0
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...
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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