Results 1 to 5 of 5

Can not copy data with VBA code

Threaded View

  1. #1
    Registered User
    Join Date
    02-03-2021
    Location
    London
    MS-Off Ver
    2007
    Posts
    37

    Can not copy data with VBA code

    Can not copy data with VBA code
    With the help of the below code, I am not able to copy the text in text files in excel cell if the text in the file starts with "="
    How can I modify the code?

    Sub rest()
    Dim r As Range, txt As String, msg As String
    With Sheets("input")
    For Each r In .Range("a2", .Range("a" & Rows.Count).End(xlUp))
    If r <> "" Then
    If Dir(r.Text) <> "" Then
    txt = CreateObject("Scripting.FileSystemObject").OpenTex tFile(r.Text).ReadAll
    r(, 2) = txt
    r(, 3) = Join(Filter(Split(txt, vbNewLine), "VBA-2", True, 1), vbLf)
    Else
    msg = msg & vbLf & r.Text
    End If
    End If
    Next
    End With
    If Len(msg) Then MsgBox "File not fouond" & msg
    End Sub
    Last edited by zeo1; 03-31-2021 at 12:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 08-21-2020, 10:47 AM
  2. [SOLVED] VB Code to copy certain data
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2019, 02:40 PM
  3. [SOLVED] Code to copy data does not copy last row in source data
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2018, 05:09 AM
  4. VBA code to make of copy of workbook2 and then copy data in that from Workbook1
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2015, 06:34 AM
  5. Replies: 2
    Last Post: 09-08-2014, 07:35 AM
  6. VBA code to copy data from Excel data table to user form
    By Srikanth H N in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2014, 11:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1