Results 1 to 5 of 5

vba to copy every singe cell using WITH

Threaded View

Muktar888 vba to copy every singe cell... 05-09-2017, 11:49 AM
Richard Buttrey Re: vba to copy every singe... 05-09-2017, 11:59 AM
Muktar888 Re: vba to copy every singe... 05-15-2017, 05:20 PM
Norie Re: vba to copy every singe... 05-15-2017, 05:34 PM
JOHN H. DAVIS Re: vba to copy every singe... 05-16-2017, 07:30 AM
  1. #1
    Registered User
    Join Date
    04-30-2017
    Location
    Pretoria, South Africa
    MS-Off Ver
    2013
    Posts
    54

    vba to copy every singe cell using WITH

    Hey guys,

    I adapted this code, I am trying to copy every single cell as is for the stipulated column, but it only copies rows in that column where there is a rank in column A. You can run my macro to see the copy over issue.

    attached is my code and excel.
    the 3rd tab shows what it should look like when copying columns A and C into dws from sws column A & B. if you make this work, il adapt it for the rest of the columns.

    It also needs to paste in the Funds sheet from row 3, not row 2.

    
    Sub fundscopyover()
    
    Dim WIP As Worksheet, Funds As Worksheet
    
    Dim sws As Worksheet, dws As Worksheet
    Dim slr As Long, dlr As Long, r As Long
    Dim sRng As Range, sCell As Range
    
    With Application
        .Calculation = xlCalculationManual
        .EnableEvents = False
        .ScreenUpdating = False
    End With
    
    Set sws = Sheets("WIP")
    Set dws = Sheets("Funds")
    slr = sws.UsedRange.Rows.Count
    
    sws.AutoFilterMode = False
    With sws
            Set sRng = sws.Range("B3:B" & slr)
            For Each sCell In sRng
                r = sCell.Row
                dlr = dws.Cells(Rows.Count, 1).End(xlUp).Row + 1
                dws.Range("A" & dlr).Value = sws.Range("A" & r).Value
                dws.Range("B" & dlr).Value = sws.Range("BB" & r).Value
                dws.Range("C" & dlr).Value = sws.Range("B" & r).Value
                dws.Range("D" & dlr).Value = sws.Range("I" & r).Value
                dws.Range("G" & dlr).Value = sws.Range("F" & r).Value
                dws.Range("H" & dlr).Value = sws.Range("G" & r).Value
                dws.Range("I" & dlr).Value = sws.Range("H" & r).Value
                dws.Range("J" & dlr).Value = sws.Range("M" & r).Value
                dws.Range("L" & dlr).Value = sws.Range("Q" & r).Value
                dws.Range("M" & dlr).Value = sws.Range("U" & r).Value
                dws.Range("N" & dlr).Value = sws.Range("Y" & r).Value
                dws.Range("O" & dlr).Value = sws.Range("AC" & r).Value
                dws.Range("P" & dlr).Value = sws.Range("AG" & r).Value
                dws.Range("Q" & dlr).Value = sws.Range("AK" & r).Value
                dws.Range("R" & dlr).Value = sws.Range("AZ" & r).Value
                dws.Range("S" & dlr).Value = sws.Range("AT" & r).Value
                dws.Range("T" & dlr).Value = sws.Range("AU" & r).Value
                dws.Range("U" & dlr).Value = sws.Range("AO" & r).Value
                dws.Range("V" & dlr).Value = sws.Range("AP" & r).Value
                dws.Range("W" & dlr).Value = sws.Range("AR" & r).Value
                dws.Range("X" & dlr).Value = sws.Range("AV" & r).Value
                dws.Range("Y" & dlr).Value = sws.Range("AW" & r).Value
                dws.Range("Z" & dlr).Value = sws.Range("AX" & r).Value
                dws.Range("AA" & dlr).Value = sws.Range("AN" & r).Value
                dws.Range("AB" & dlr).Value = sws.Range("D" & r).Value
            Next sCell
        
    End With
    
    
    With Application
        .Calculation = xlCalculationAutomatic
        .EnableEvents = True
        .ScreenUpdating = True
    End With
    
    
    End Sub
    Thanks guys
    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] Combine Multiple Worksheet Change Events in a Singe Woksheet
    By Kimston in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-21-2015, 11:48 AM
  2. Conditional formatting in multiple cell based on a singe cell
    By Macster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2014, 04:12 AM
  3. [SOLVED] Sorting singe row and column data into row and multiple colums
    By dhbyrne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2014, 04:56 AM
  4. Condensing a list into singe entries for an overview.
    By JSallen in forum Excel General
    Replies: 3
    Last Post: 11-30-2012, 06:40 PM
  5. Copy Pictures from separate sheets to one singe sheet.
    By Fishwise in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2009, 03:03 PM
  6. How to add a singe symbol to the whole column data?
    By usmleboy in forum Excel General
    Replies: 3
    Last Post: 01-07-2006, 04:10 AM
  7. [SOLVED] How can you identify duplicate entries in a singe column?
    By Melissa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2006, 05:25 PM

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