Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

enhance code to only include text and not carry over formatting

is there a way to enhance the code below to only copy over "text"...and not formatting.

Sub CopyData(colFrom As String, colTo As String)
    ThisWorkbook.Activate
    ws.Range(colFrom & "6:" & colFrom & rwMax).Copy
    wb.Activate
    Range(colTo & 3).Select
    ActiveSheet.Paste
End Sub

Open in new window



Thanks
fordraiders
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Replace line 6 with
ActiveSheet.PasteSpecial xlPasteValues
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fordraiders

ASKER

Martin:  

runtime error 1004
PasteSpecial  method of Worksheet class failed.
Saurabh,
Range(colTo & 3).PasteSpecial xlPasteValues

worked fine...

Thanks !
fordraiders..Always Happy to help.. :-)

Saurabh...
Thanks