ActiveWorkbook

cccbzg

Board Regular
Joined
Oct 5, 2014
Messages
68
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm wondering how I can change this line of code to make my field (CsaveDAYS) contain both the value AND the format from my range ("D" & i).

Thanks in advance for your help!

Bonnie

CsaveDAYS = ActiveWorkbook.Sheets("Summary Sheet").Range("D" & i).Value
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
What is you ultimate goal with this?
That is, what are you going to do with that cell's value and its formatting?
 
Upvote 0
What is you ultimate goal with this?
That is, what are you going to do with that cell's value and its formatting?

Im going to output the value with format into a cell in another sheet eventually, but I need to hold onto it until I get to a certain record type. So, I’ve got header type records and detail records on my input sheet and only detail records which need header data on my output sheet.

Hope me that makes sense.

Thanks so much.

Bonnie
 
Upvote 0
So, if you don't yet know where you are going to put it, set it to a Range variable
Code:
Dim rng as Range
Set rng = ActiveWorkbook.Sheets("Summary Sheet").Range("D" & i)

Then, when you have worked out where to put it (say in the same workbook, sheet "abc", cell K5)
Code:
rng.Copy Destination:= ActiveWorkbook.Sheets("abc").Range("K5")
 
Upvote 0
So, if you don't yet know where you are going to put it, set it to a Range variable
Code:
Dim rng as Range
Set rng = ActiveWorkbook.Sheets("Summary Sheet").Range("D" & i)

Then, when you have worked out where to put it (say in the same workbook, sheet "abc", cell K5)
Code:
rng.Copy Destination:= ActiveWorkbook.Sheets("abc").Range("K5")


Thanks! Will try later today and let you know how it goes.

I appreciate your your time and willingness to share expertise.

Bonnie
 
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,899
Members
449,477
Latest member
panjongshing

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