Consulting

Results 1 to 2 of 2

Thread: Format gets lost

  1. #1

    Format gets lost

    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

    [VBA]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
    [/VBA]
    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

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    try[VBA]Data.Cells(Row, Col).copy RFC.Cells(Row, Col)[/VBA]but is there a formula you want to lose while copying?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •