Results 1 to 4 of 4

Vba code to extract data from one sheet to another

Threaded View

xlhelp7 Vba code to extract data from... 03-02-2016, 06:52 AM
LeoTaxi Re: Vba code to extract data... 03-02-2016, 08:18 AM
LeoTaxi Re: Vba code to extract data... 03-02-2016, 07:26 PM
xlhelp7 Re: Vba code to extract data... 03-03-2016, 01:17 AM
  1. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Vba code to extract data from one sheet to another

    This takes date from column A, that is different from column F

    Sub test()
    Dim lastrow As Long, x As Long, r As Integer, r2 As Integer, r3 As Integer
    Dim mystring1 As String, mystring2 As String, mystring3 As String
    With Sheets("sheet1").Range("A1").CurrentRegion
        .Copy Sheets("sheet2").Range("D1")
    End With
    With Sheets("sheet2")
        lastrow = .Range("D" & Rows.Count).End(xlUp).Row
        .Range("A1").Resize(, 3) = Array("Name", "Date", "Mobile#")
        .Range("D1", "D" & lastrow).Copy
        .Range("A1", "C" & lastrow).PasteSpecial Paste:=xlPasteFormats
        Application.CutCopyMode = False
        For x = 2 To lastrow
            r = InStr(4, .Range("D" & x), "\")
            r2 = InStr(r + 1, .Range("D" & x), "\")
            r3 = InStr(1, .Range("E" & x), "_")
            mystring1 = Mid(.Range("D" & x), r + 1, r2 - r - 1)
            mystring2 = Mid(.Range("D" & x), r2 + 1, Len(.Range("D" & x)) - (r2 + 1))
            mystring3 = Mid(.Range("E" & x), 1, r3 - 1)
            .Range("A" & x).Resize(, 3) = Array(mystring1, mystring2, "'" & mystring3)
        Next
        .Columns.AutoFit
    End With
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA code to browse for external excel file and extract its all sheet to current workbook
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2016, 04:05 AM
  2. Vba code to Extract data from multiple sheet
    By Masa1989 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2015, 01:51 AM
  3. Code to Extract data from multiple workbooks and Multiple sheet
    By Masa1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2015, 07:05 AM
  4. Replies: 3
    Last Post: 12-18-2014, 10:27 AM
  5. [SOLVED] Desire data extract from the sheet “input” to the sheet “output”
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-24-2014, 02:19 PM
  6. [SOLVED] How to code a macro to extract data from multiple sheets into one sheet?
    By likeabottle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2013, 04:51 PM
  7. I want vba code to extract details from one sheet to another by button click
    By Raj@Akhil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2012, 05:27 AM

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