Results 1 to 9 of 9

VBA Copy and Paste data to another sheet(with a date and day)?

Threaded View

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    VBA Copy and Paste data to another sheet(with a date and day)?

    Now, I have a major problem with copy and paste data. My data have some format that need to fulfill. With characters, date and day.

    The output should be like this....

    SEE the attachment below:
    actualoutput.JPG

    BUT I can't copy some of the data because some problem occur and not being copy and paste correctly.

    Previous code: INCOMPLETE

    Sub copyPasteData()
        
        Dim LResult As String
        
        i = 3
        n = 2
        
        For Each sh In Worksheets
            
            If sh.Name <> "Head Office" Then
            
                With sh.[A3]
                
                For k = 2 To .CurrentRegion.Columns.Count
                    
                   
                    LResult = Left(sh.Name, 4)
                    
                    
                    Sheets("Head Office").Cells(i, 1).Resize(24) = sh.Name
                    Sheets("Head Office").Cells(i, 2).Resize(24) = LResult
                    'Sheets("Head Office").Cells(i, 3).Resize(24) =
                    
                    Sheets("Head Office").Cells(i, 4).Resize(24) = .Columns(k).Value
                    
                    'Sheets("Head Office").Cells(i, 5).Resize(24) =
                    
                    Sheets("Head Office").Cells(i, 6).Resize(24) = Intersect(.CurrentRegion, .CurrentRegion.Offset(3).Columns(1)).Value
                    Sheets("Head Office").Cells(i, 7).Resize(24) = .CurrentRegion.Offset(3).Columns(n).Value
                    
                    i = i + 24
                    n = n + 1
     
                Next k
               
                End With
                
            End If
            
            n = 2
       
        Next sh
        
    End Sub
    Please see the attachment below:
    actualoutput.JPG -> Need to be the OUTPUT


    WORKBOOK:
    Sample MQ Data.xlsb
    Last edited by mcmunoz; 08-06-2013 at 09:02 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 05-21-2013, 03:09 PM
  2. [SOLVED] Userform for date entry and then copy/paste matching data to another sheet
    By nymanns in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 03:22 AM
  3. Copy/paste row with todays date in Sheet2 to sheet 3....but from Sheet 1
    By cammyjane10 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-25-2013, 01:07 PM
  4. [SOLVED] Edit Macro to Copy and Paste Data from another sheet according to date
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2012, 02:57 AM
  5. Replies: 2
    Last Post: 02-22-2011, 02:07 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