+ Reply to Thread
Results 1 to 4 of 4

Copy data in Specific column in a specific range

Hybrid View

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Copy data in Specific column in a specific range

    Hi There,

    I have a worksheet that collates data from batches in sequence order. For eg: I already have data(Say eg, column A to Z) for batch 1. After batch 2 is succesful I am pullimng data from batch 2 extract file to my worksheet and adding after batch 1 data because order of column is same for all batches.

    I have a macro which perfectly do this. But just a section of macro fill formulas in column A, B, J, L amd M and copy data in K column. Below is the code.
    bLR = Range("A" & Rows.Count).End(xlUp).Row
    lLR = Range("C" & Rows.Count).End(xlUp).Row
    
     Range("A" & bLR & ":B" & bLR).AutoFill Destination:=Range("A" & bLR & ":B" & lLR), Type:=xlFillDefault
      Range("J" & bLR).AutoFill Destination:=Range("J" & bLR & ":J" & lLR), Type:=xlFillDefault
      Range("K" & bLR).Copy ThisWorkbook.Worksheets("Abslayer_SAP_BCN").Range("K" & Rows.Count).End(xlUp).Offset(1, 0)
      Range("L" & bLR & ":M" & bLR).AutoFill Destination:=Range("L" & bLR & ":M" & lLR), Type:=xlFillDefault
     Calculate
    The below line of code does not copy the data.

      Range("K" & bLR).Copy ThisWorkbook.Worksheets("Abslayer_SAP_BCN").Range("K" & Rows.Count).End(xlUp).Offset(1, 0)
    Can someone help please?

    Thanks,
    Su.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Copy data in Specific column in a specific range

    Maybe. I haven't looked at anything else, just saw this flaw

    Range("K" & bLR).Copy Destination:=ThisWorkbook.Worksheets("Abslayer_SAP_BCN").Range("K" & Rows.Count).End(xlUp).Offset(1, 0)

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    You don't specify the workbook and worksheet you are copying from.

    That will mean the code will copy from the active sheet, which might not be the correct one.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Copy data in Specific column in a specific range

    Thanks stnkynts and Norie for your reply.

    Apologise. I should have detailed before.

    Yes it would be the active sheet.

    bLR is storing the lowest column and lLR is the largest column count in 'Abslayer_SAP_BCN' sheet. What I am trying to do is copy K (bLR -1) (which is the value) to Range(KbLR to End of column count)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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