简体   繁体   中英

Copy cell data as string and paste into new cell

One of the instruments I use at work has an option to record data into Excel. The data it spits out is unreadable in its raw form.

I found if I copy the string that appears in the formula bar (rather than just selecting the cell itself and copying) and paste it into another cell, it expands the data to make it readable.

All the copy/paste macros I found copy the cell into another cell, which in this case preserves the initial formatting.

I need to copy the string, rather than the cell, and paste it into another cell.

I don't know about your unreadable data. see if following code works? change code according to your sheet/data

Sub text_Writing_through_Variable() 
    Dim text As String
    text = ActiveCell.FormulaR1C1 ' Make a String of data contain in active cell
    Range("a5").Value = text      'paste String in `A5`
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM