PDA

View Full Version : Format gets lost



gmcconville
02-28-2012, 07:56 PM
Hi, I want to copy the value of a cell from one sheet to another.

However when I do this, it changes the cell format from Accounting Format to Currency Format.

Any idea how to stop this from happening?

Line of code is

Dim RFC as Worksheet
Dim Data as Worksheet
Set RFC = Worksheets("RFC")
Set Data = Worksheets("Data")
RFC.Cells(Row, Col).Value = Data.Cells(Row, Col).Value

I see there is a FormatCurrency command, but could not find a FormatAccounting command.

I realise that I could just change the format back afterwards, but if I am doing this for a number of lines then it gets time consuming

Thanks

p45cal
02-29-2012, 12:52 AM
tryData.Cells(Row, Col).copy RFC.Cells(Row, Col)but is there a formula you want to lose while copying?